rpc: return 0x0 as extra data in block instead of nil (#333)
* return 0x0 extra data instead of nil * add fix for getBlock * add tests
This commit is contained in:
parent
7b164a5aa4
commit
94f6acc651
@ -526,7 +526,7 @@ func formatBlock(
|
|||||||
"miner": common.Address{},
|
"miner": common.Address{},
|
||||||
"difficulty": nil,
|
"difficulty": nil,
|
||||||
"totalDifficulty": nil,
|
"totalDifficulty": nil,
|
||||||
"extraData": nil,
|
"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
|
||||||
"gasUsed": (*hexutil.Big)(gasUsed),
|
"gasUsed": (*hexutil.Big)(gasUsed),
|
||||||
|
@ -634,11 +634,11 @@ func TestBlockBloom(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBlockBloom_Hash(t *testing.T) {
|
func TestBlockBloom_Hash(t *testing.T) {
|
||||||
t.Skip()
|
|
||||||
// TODO: get this to work
|
|
||||||
hash := deployTestContractWithFunction(t)
|
hash := deployTestContractWithFunction(t)
|
||||||
receipt := waitForReceipt(t, hash)
|
receipt := waitForReceipt(t, hash)
|
||||||
|
|
||||||
|
time.Sleep(time.Second * 3)
|
||||||
|
|
||||||
blockHash := receipt["blockHash"].(string)
|
blockHash := receipt["blockHash"].(string)
|
||||||
|
|
||||||
param := []interface{}{blockHash, false}
|
param := []interface{}{blockHash, false}
|
||||||
@ -685,3 +685,13 @@ func TestEth_EstimateGas(t *testing.T) {
|
|||||||
|
|
||||||
require.Equal(t, hexutil.Bytes{0xf7, 0xa6}, gas)
|
require.Equal(t, hexutil.Bytes{0xf7, 0xa6}, gas)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEth_GetBlockByNumber(t *testing.T) {
|
||||||
|
param := []interface{}{"0x1", false}
|
||||||
|
rpcRes := call(t, "eth_getBlockByNumber", param)
|
||||||
|
|
||||||
|
block := make(map[string]interface{})
|
||||||
|
err := json.Unmarshal(rpcRes.Result, &block)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, "0x0", block["extraData"].(string))
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user