aboutsummaryrefslogtreecommitdiffstats
path: root/core/database_util.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-11-09 08:20:49 +0800
committerFelix Lange <fjl@twurst.com>2016-11-09 09:19:07 +0800
commitbe3865211c2d8f71e0733b17c469881502e89371 (patch)
tree1b92be622d4d54d7f7d2ecfb9652c9a071172cd6 /core/database_util.go
parent0f19cbc6e5b842fb271eedeed47f433d0c63ff2e (diff)
downloadgo-tangerine-be3865211c2d8f71e0733b17c469881502e89371.tar.gz
go-tangerine-be3865211c2d8f71e0733b17c469881502e89371.tar.zst
go-tangerine-be3865211c2d8f71e0733b17c469881502e89371.zip
core/types: remove header accessors
These accessors were introduced by light client changes, but the only method that is actually used is GetNumberU64. This commit replaces all uses of .GetNumberU64 with .Number.Uint64.
Diffstat (limited to 'core/database_util.go')
-rw-r--r--core/database_util.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/database_util.go b/core/database_util.go
index 73fac20aa..0fb593554 100644
--- a/core/database_util.go
+++ b/core/database_util.go
@@ -632,24 +632,24 @@ func GetChainConfig(db ethdb.Database, hash common.Hash) (*ChainConfig, error) {
// FindCommonAncestor returns the last common ancestor of two block headers
func FindCommonAncestor(db ethdb.Database, a, b *types.Header) *types.Header {
- for a.GetNumberU64() > b.GetNumberU64() {
- a = GetHeader(db, a.ParentHash, a.GetNumberU64()-1)
+ for bn := b.Number.Uint64(); a.Number.Uint64() > bn; {
+ a = GetHeader(db, a.ParentHash, a.Number.Uint64()-1)
if a == nil {
return nil
}
}
- for a.GetNumberU64() < b.GetNumberU64() {
- b = GetHeader(db, b.ParentHash, b.GetNumberU64()-1)
+ for an := a.Number.Uint64(); an < b.Number.Uint64(); {
+ b = GetHeader(db, b.ParentHash, b.Number.Uint64()-1)
if b == nil {
return nil
}
}
for a.Hash() != b.Hash() {
- a = GetHeader(db, a.ParentHash, a.GetNumberU64()-1)
+ a = GetHeader(db, a.ParentHash, a.Number.Uint64()-1)
if a == nil {
return nil
}
- b = GetHeader(db, b.ParentHash, b.GetNumberU64()-1)
+ b = GetHeader(db, b.ParentHash, b.Number.Uint64()-1)
if b == nil {
return nil
}