forked from cerc-io/laconicd-deprecated
update block format to match geth (#532)
This commit is contained in:
parent
c1df065d3e
commit
1339c174d7
@ -20,6 +20,7 @@ import (
|
|||||||
|
|
||||||
abci "github.com/tendermint/tendermint/abci/types"
|
abci "github.com/tendermint/tendermint/abci/types"
|
||||||
"github.com/tendermint/tendermint/crypto/merkle"
|
"github.com/tendermint/tendermint/crypto/merkle"
|
||||||
|
tmbytes "github.com/tendermint/tendermint/libs/bytes"
|
||||||
"github.com/tendermint/tendermint/libs/log"
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
"github.com/tendermint/tendermint/rpc/client"
|
"github.com/tendermint/tendermint/rpc/client"
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
@ -621,18 +622,23 @@ func formatBlock(
|
|||||||
header tmtypes.Header, size int, gasLimit int64,
|
header tmtypes.Header, size int, gasLimit int64,
|
||||||
gasUsed *big.Int, transactions interface{}, bloom ethtypes.Bloom,
|
gasUsed *big.Int, transactions interface{}, bloom ethtypes.Bloom,
|
||||||
) map[string]interface{} {
|
) map[string]interface{} {
|
||||||
|
if bytes.Equal(header.DataHash, []byte{}) {
|
||||||
|
header.DataHash = tmbytes.HexBytes(common.Hash{}.Bytes())
|
||||||
|
}
|
||||||
|
|
||||||
return map[string]interface{}{
|
return map[string]interface{}{
|
||||||
"number": hexutil.Uint64(header.Height),
|
"number": hexutil.Uint64(header.Height),
|
||||||
"hash": hexutil.Bytes(header.Hash()),
|
"hash": hexutil.Bytes(header.Hash()),
|
||||||
"parentHash": hexutil.Bytes(header.LastBlockID.Hash),
|
"parentHash": hexutil.Bytes(header.LastBlockID.Hash),
|
||||||
"nonce": nil, // PoW specific
|
"nonce": hexutil.Uint64(0), // PoW specific
|
||||||
"sha3Uncles": nil, // No uncles in Tendermint
|
"sha3Uncles": common.Hash{}, // No uncles in Tendermint
|
||||||
"logsBloom": bloom,
|
"logsBloom": bloom,
|
||||||
"transactionsRoot": hexutil.Bytes(header.DataHash),
|
"transactionsRoot": hexutil.Bytes(header.DataHash),
|
||||||
"stateRoot": hexutil.Bytes(header.AppHash),
|
"stateRoot": hexutil.Bytes(header.AppHash),
|
||||||
"miner": common.Address{},
|
"miner": common.Address{},
|
||||||
"difficulty": nil,
|
"mixHash": common.Hash{},
|
||||||
"totalDifficulty": nil,
|
"difficulty": 0,
|
||||||
|
"totalDifficulty": 0,
|
||||||
"extraData": hexutil.Uint64(0),
|
"extraData": hexutil.Uint64(0),
|
||||||
"size": hexutil.Uint64(size),
|
"size": hexutil.Uint64(size),
|
||||||
"gasLimit": hexutil.Uint64(gasLimit), // Static gas limit
|
"gasLimit": hexutil.Uint64(gasLimit), // Static gas limit
|
||||||
@ -640,6 +646,7 @@ func formatBlock(
|
|||||||
"timestamp": hexutil.Uint64(header.Time.Unix()),
|
"timestamp": hexutil.Uint64(header.Time.Unix()),
|
||||||
"transactions": transactions.([]common.Hash),
|
"transactions": transactions.([]common.Hash),
|
||||||
"uncles": []string{},
|
"uncles": []string{},
|
||||||
|
"receiptsRoot": common.Hash{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user