diff --git a/geth/geth_block_to_core_block.go b/geth/geth_block_to_core_block.go index 256c3f67..58166075 100644 --- a/geth/geth_block_to_core_block.go +++ b/geth/geth_block_to_core_block.go @@ -3,8 +3,8 @@ package geth import ( "github.com/8thlight/vulcanizedb/core" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" - "strconv" ) func gethTransToCoreTrans(transaction *types.Transaction) core.Transaction { @@ -31,7 +31,7 @@ func GethBlockToCoreBlock(gethBlock *types.Block) core.Block { GasLimit: gethBlock.GasLimit().Int64(), GasUsed: gethBlock.GasUsed().Int64(), Hash: gethBlock.Hash().Hex(), - Nonce: strconv.FormatUint(gethBlock.Nonce(), 10), + Nonce: hexutil.Encode(gethBlock.Header().Nonce[:]), Number: gethBlock.Number().Int64(), ParentHash: gethBlock.ParentHash().Hex(), Size: gethBlock.Size().Int64(), diff --git a/geth/geth_block_to_core_block_test.go b/geth/geth_block_to_core_block_test.go index 3eabce16..444f03e6 100644 --- a/geth/geth_block_to_core_block_test.go +++ b/geth/geth_block_to_core_block_test.go @@ -5,10 +5,10 @@ import ( "github.com/8thlight/vulcanizedb/geth" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "strconv" ) var _ = Describe("Conversion of GethBlock to core.Block", func() { @@ -38,7 +38,7 @@ var _ = Describe("Conversion of GethBlock to core.Block", func() { Expect(gethBlock.GasLimit).To(Equal(gasLimit)) Expect(gethBlock.GasUsed).To(Equal(gasUsed)) Expect(gethBlock.Hash).To(Equal(block.Hash().Hex())) - Expect(gethBlock.Nonce).To(Equal((strconv.FormatUint(block.Nonce(), 10)))) + Expect(gethBlock.Nonce).To(Equal(hexutil.Encode(header.Nonce[:]))) Expect(gethBlock.Number).To(Equal(number)) Expect(gethBlock.ParentHash).To(Equal(block.ParentHash().Hex())) Expect(gethBlock.Size).To(Equal(block.Size().Int64()))