This commit is contained in:
Matt Krump 2017-11-02 16:43:07 -05:00
parent df09cf8d93
commit 946eb23861
2 changed files with 4 additions and 4 deletions

View File

@ -3,8 +3,8 @@ package geth
import ( import (
"github.com/8thlight/vulcanizedb/core" "github.com/8thlight/vulcanizedb/core"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"strconv"
) )
func gethTransToCoreTrans(transaction *types.Transaction) core.Transaction { func gethTransToCoreTrans(transaction *types.Transaction) core.Transaction {
@ -31,7 +31,7 @@ func GethBlockToCoreBlock(gethBlock *types.Block) core.Block {
GasLimit: gethBlock.GasLimit().Int64(), GasLimit: gethBlock.GasLimit().Int64(),
GasUsed: gethBlock.GasUsed().Int64(), GasUsed: gethBlock.GasUsed().Int64(),
Hash: gethBlock.Hash().Hex(), Hash: gethBlock.Hash().Hex(),
Nonce: strconv.FormatUint(gethBlock.Nonce(), 10), Nonce: hexutil.Encode(gethBlock.Header().Nonce[:]),
Number: gethBlock.Number().Int64(), Number: gethBlock.Number().Int64(),
ParentHash: gethBlock.ParentHash().Hex(), ParentHash: gethBlock.ParentHash().Hex(),
Size: gethBlock.Size().Int64(), Size: gethBlock.Size().Int64(),

View File

@ -5,10 +5,10 @@ import (
"github.com/8thlight/vulcanizedb/geth" "github.com/8thlight/vulcanizedb/geth"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"strconv"
) )
var _ = Describe("Conversion of GethBlock to core.Block", func() { 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.GasLimit).To(Equal(gasLimit))
Expect(gethBlock.GasUsed).To(Equal(gasUsed)) Expect(gethBlock.GasUsed).To(Equal(gasUsed))
Expect(gethBlock.Hash).To(Equal(block.Hash().Hex())) 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.Number).To(Equal(number))
Expect(gethBlock.ParentHash).To(Equal(block.ParentHash().Hex())) Expect(gethBlock.ParentHash).To(Equal(block.ParentHash().Hex()))
Expect(gethBlock.Size).To(Equal(block.Size().Int64())) Expect(gethBlock.Size).To(Equal(block.Size().Int64()))