From 28d025fdafea22e2211ec62c19a59ca2851bea73 Mon Sep 17 00:00:00 2001 From: SebastianJ Date: Thu, 25 Feb 2021 08:19:47 +0100 Subject: [PATCH] Use BlockNonce type for marshaling nonce fields for blocks --- rpc/eth/types.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rpc/eth/types.go b/rpc/eth/types.go index 17ba6fa7b..9cd1d9dba 100644 --- a/rpc/eth/types.go +++ b/rpc/eth/types.go @@ -8,17 +8,18 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/harmony-one/harmony/core/types" + hmytypes "github.com/harmony-one/harmony/core/types" internal_common "github.com/harmony-one/harmony/internal/common" rpc_common "github.com/harmony-one/harmony/rpc/common" ) // Block represents a basic block which is further amended by BlockWithTxHash or BlockWithFullTx type Block struct { - Number *hexutil.Big `json:"number"` - Hash common.Hash `json:"hash"` - ParentHash common.Hash `json:"parentHash"` - Nonce uint64 `json:"nonce"` - MixHash common.Hash `json:"mixHash"` + Number *hexutil.Big `json:"number"` + Hash common.Hash `json:"hash"` + ParentHash common.Hash `json:"parentHash"` + Nonce hmytypes.BlockNonce `json:"nonce"` + MixHash common.Hash `json:"mixHash"` //UncleHash common.Hash `json:"sha3Uncles" - used in Ethereum RPC:s LogsBloom ethtypes.Bloom `json:"logsBloom"` StateRoot common.Hash `json:"stateRoot"` @@ -161,12 +162,12 @@ func newBlock(b *types.Block, leader common.Address) *Block { Number: (*hexutil.Big)(head.Number()), Hash: b.Hash(), ParentHash: head.ParentHash(), - Nonce: 0, // Remove this because we don't have it in our header + Nonce: hmytypes.BlockNonce{}, // Legacy comment from hmy -> eth RPC porting: "Remove this because we don't have it in our header" MixHash: head.MixDigest(), LogsBloom: head.Bloom(), StateRoot: head.Root(), Miner: leader, - Difficulty: (*hexutil.Big)(big.NewInt(0)), // Remove this because we don't have it in our header + Difficulty: (*hexutil.Big)(big.NewInt(0)), // Legacy comment from hmy -> eth RPC porting: "Remove this because we don't have it in our header" ExtraData: hexutil.Bytes(head.Extra()), Size: hexutil.Uint64(b.Size()), GasLimit: hexutil.Uint64(head.GasLimit()),