diff --git a/cmd/rpcdaemon/commands/eth_ming_test.go b/cmd/rpcdaemon/commands/eth_ming_test.go index f46e2638c..edd5dbc91 100644 --- a/cmd/rpcdaemon/commands/eth_ming_test.go +++ b/cmd/rpcdaemon/commands/eth_ming_test.go @@ -33,10 +33,10 @@ func TestPendingBlock(t *testing.T) { ff.HandlePendingBlock(&txpool.OnPendingBlockReply{RplBlock: b}) block := api.pendingBlock() - require.Equal(t, block.Number().Uint64(), expect) + require.Equal(t, block.NumberU64(), expect) select { case got := <-ch: - require.Equal(t, expect, got.Number().Uint64()) + require.Equal(t, expect, got.NumberU64()) case <-time.After(100 * time.Millisecond): t.Fatalf("timeout waiting for expected notification") } diff --git a/cmd/state/commands/check_change_sets.go b/cmd/state/commands/check_change_sets.go index fae3c8c2b..38713577e 100644 --- a/cmd/state/commands/check_change_sets.go +++ b/cmd/state/commands/check_change_sets.go @@ -145,7 +145,7 @@ func CheckChangeSets(genesis *core.Genesis, logger log.Logger, blockNum uint64, return err1 } if writeReceipts { - if chainConfig.IsByzantium(block.Number().Uint64()) { + if chainConfig.IsByzantium(block.NumberU64()) { receiptSha := types.DeriveSha(receipts) if receiptSha != block.ReceiptHash() { return fmt.Errorf("mismatched receipt headers for block %d", block.NumberU64()) diff --git a/cmd/state/commands/opcode_tracer.go b/cmd/state/commands/opcode_tracer.go index 41baa630f..0977ca308 100644 --- a/cmd/state/commands/opcode_tracer.go +++ b/cmd/state/commands/opcode_tracer.go @@ -555,7 +555,7 @@ func OpcodeTracer(genesis *core.Genesis, blockNum uint64, chaindata string, numB if err1 != nil { return err1 } - if chainConfig.IsByzantium(block.Number().Uint64()) { + if chainConfig.IsByzantium(block.NumberU64()) { receiptSha := types.DeriveSha(receipts) if receiptSha != block.ReceiptHash() { return fmt.Errorf("mismatched receipt headers for block %d", block.NumberU64()) diff --git a/consensus/ethash/sealer_test.go b/consensus/ethash/sealer_test.go index 67391b0f4..62152839c 100644 --- a/consensus/ethash/sealer_test.go +++ b/consensus/ethash/sealer_test.go @@ -302,8 +302,8 @@ func TestStaleSubmission(t *testing.T) { if res.Difficulty().Uint64() != c.headers[c.submitIndex].Difficulty.Uint64() { t.Errorf("case %d block difficulty mismatch, want %d, get %d", id+1, c.headers[c.submitIndex].Difficulty, res.Difficulty()) } - if res.Number().Uint64() != c.headers[c.submitIndex].Number.Uint64() { - t.Errorf("case %d block number mismatch, want %d, get %d", id+1, c.headers[c.submitIndex].Number.Uint64(), res.Number().Uint64()) + if res.NumberU64() != c.headers[c.submitIndex].Number.Uint64() { + t.Errorf("case %d block number mismatch, want %d, get %d", id+1, c.headers[c.submitIndex].Number.Uint64(), res.NumberU64()) } if res.ParentHash() != c.headers[c.submitIndex].ParentHash { t.Errorf("case %d block parent hash mismatch, want %s, get %s", id+1, c.headers[c.submitIndex].ParentHash.Hex(), res.ParentHash().Hex()) diff --git a/core/chain_makers.go b/core/chain_makers.go index 92a740e3e..253a68a81 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -376,7 +376,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse for i := 0; i < n; i++ { stateReader := state.NewPlainStateReader(tx) - plainStateWriter := state.NewPlainStateWriter(tx, nil, parent.Number().Uint64()+uint64(i)+1) + plainStateWriter := state.NewPlainStateWriter(tx, nil, parent.NumberU64()+uint64(i)+1) ibs := state.New(stateReader) block, receipt, err := genblock(i, parent, ibs, stateReader, plainStateWriter) if err != nil { @@ -408,7 +408,7 @@ func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.I Difficulty: engine.CalcDifficulty(chain, time, time-10, parent.Difficulty(), - parent.Number().Uint64(), + parent.NumberU64(), parent.Hash(), parent.UncleHash(), parent.Seal(), diff --git a/migrations/receipt_repair.go b/migrations/receipt_repair.go index 435a9d5cc..488217256 100644 --- a/migrations/receipt_repair.go +++ b/migrations/receipt_repair.go @@ -121,7 +121,7 @@ var ReceiptRepair = Migration{ return err1 } fix := true - if chainConfig.IsByzantium(block.Number().Uint64()) { + if chainConfig.IsByzantium(block.NumberU64()) { receiptSha := types.DeriveSha(receipts1) if receiptSha != block.ReceiptHash() { fmt.Printf("(retrace) mismatched receipt headers for block %d: %x, %x\n", block.NumberU64(), receiptSha, block.ReceiptHash()) diff --git a/tests/state_test_util.go b/tests/state_test_util.go index cc1cbca88..4529bbfdf 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -186,7 +186,7 @@ func (t *StateTest) RunNoVerify(rules params.Rules, tx kv.RwTx, subtest StateSub return nil, common.Hash{}, UnsupportedForkError{subtest.Fork} } - readBlockNr := block.Number().Uint64() + readBlockNr := block.NumberU64() writeBlockNr := readBlockNr + 1 _, err = MakePreState(params.Rules{}, tx, t.json.Pre, readBlockNr)