From 4761c1db956deaf43ce29eda5c68222cbf2411a8 Mon Sep 17 00:00:00 2001 From: alan <652732310@qq.com> Date: Wed, 25 Sep 2024 23:18:01 +0800 Subject: [PATCH] unify with NumberU64 --- core/types/block.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/types/block.go b/core/types/block.go index 1c00658d5b38..0c1e7ea3eb30 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -127,6 +127,10 @@ func (h *Header) Hash() common.Hash { return rlpHash(h) } +func (h *Header) NumberU64() uint64 { + return h.Number.Uint64() +} + var headerSize = common.StorageSize(reflect.TypeOf(Header{}).Size()) // Size returns the approximate memory used by all internal contents. It is used @@ -400,7 +404,7 @@ func (b *Block) GasUsed() uint64 { return b.header.GasUsed } func (b *Block) Difficulty() *big.Int { return new(big.Int).Set(b.header.Difficulty) } func (b *Block) Time() uint64 { return b.header.Time } -func (b *Block) NumberU64() uint64 { return b.header.Number.Uint64() } +func (b *Block) NumberU64() uint64 { return b.header.NumberU64() } func (b *Block) MixDigest() common.Hash { return b.header.MixDigest } func (b *Block) Nonce() uint64 { return binary.BigEndian.Uint64(b.header.Nonce[:]) } func (b *Block) Bloom() Bloom { return b.header.Bloom }