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:
noot
2020-06-17 12:14:21 -04:00
committed by GitHub
parent 7b164a5aa4
commit 94f6acc651
2 changed files with 13 additions and 3 deletions
+12 -2
View File
@@ -634,11 +634,11 @@ func TestBlockBloom(t *testing.T) {
}
func TestBlockBloom_Hash(t *testing.T) {
t.Skip()
// TODO: get this to work
hash := deployTestContractWithFunction(t)
receipt := waitForReceipt(t, hash)
time.Sleep(time.Second * 3)
blockHash := receipt["blockHash"].(string)
param := []interface{}{blockHash, false}
@@ -685,3 +685,13 @@ func TestEth_EstimateGas(t *testing.T) {
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))
}