aboutsummaryrefslogtreecommitdiffstats
path: root/les
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 /les
parent0f19cbc6e5b842fb271eedeed47f433d0c63ff2e (diff)
downloaddexon-be3865211c2d8f71e0733b17c469881502e89371.tar
dexon-be3865211c2d8f71e0733b17c469881502e89371.tar.gz
dexon-be3865211c2d8f71e0733b17c469881502e89371.tar.bz2
dexon-be3865211c2d8f71e0733b17c469881502e89371.tar.lz
dexon-be3865211c2d8f71e0733b17c469881502e89371.tar.xz
dexon-be3865211c2d8f71e0733b17c469881502e89371.tar.zst
dexon-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 'les')
-rw-r--r--les/fetcher.go4
-rw-r--r--les/odr_test.go2
-rw-r--r--les/request_test.go4
-rw-r--r--les/server.go4
4 files changed, 7 insertions, 7 deletions
diff --git a/les/fetcher.go b/les/fetcher.go
index 3fa5cf0e2..d93b7db37 100644
--- a/les/fetcher.go
+++ b/les/fetcher.go
@@ -103,7 +103,7 @@ func (f *lightFetcher) gotHeader(header *types.Header) {
if peerList == nil {
return
}
- number := header.GetNumberU64()
+ number := header.Number.Uint64()
td := core.GetTd(f.pm.chainDb, hash, number)
for _, peer := range peerList {
peer.lock.Lock()
@@ -201,7 +201,7 @@ func (f *lightFetcher) processResponse(req fetchRequest, resp fetchResponse) boo
return false
}
for _, header := range headers {
- td := core.GetTd(f.pm.chainDb, header.Hash(), header.GetNumberU64())
+ td := core.GetTd(f.pm.chainDb, header.Hash(), header.Number.Uint64())
if td == nil {
return false
}
diff --git a/les/odr_test.go b/les/odr_test.go
index bd52a82dd..cdf62464b 100644
--- a/les/odr_test.go
+++ b/les/odr_test.go
@@ -193,7 +193,7 @@ func testOdr(t *testing.T, protocol int, expFail uint64, fn odrTestFn) {
lpm.synchronise(lpeer)
test := func(expFail uint64) {
- for i := uint64(0); i <= pm.blockchain.CurrentHeader().GetNumberU64(); i++ {
+ for i := uint64(0); i <= pm.blockchain.CurrentHeader().Number.Uint64(); i++ {
bhash := core.GetCanonicalHash(db, i)
b1 := fn(light.NoOdr, db, pm.chainConfig, pm.blockchain.(*core.BlockChain), nil, bhash)
ctx, _ := context.WithTimeout(context.Background(), 200*time.Millisecond)
diff --git a/les/request_test.go b/les/request_test.go
index df02afb32..77788d4a9 100644
--- a/les/request_test.go
+++ b/les/request_test.go
@@ -42,7 +42,7 @@ func TestCodeAccessLes1(t *testing.T) { testAccess(t, 1, tfCodeAccess) }
func tfCodeAccess(db ethdb.Database, bhash common.Hash, number uint64) light.OdrRequest {
header := core.GetHeader(db, bhash, core.GetBlockNumber(db, bhash))
- if header.GetNumberU64() < testContractDeployed {
+ if header.Number.Uint64() < testContractDeployed {
return nil
}
sti := light.StateTrieID(header)
@@ -66,7 +66,7 @@ func testAccess(t *testing.T, protocol int, fn accessTestFn) {
lpm.synchronise(lpeer)
test := func(expFail uint64) {
- for i := uint64(0); i <= pm.blockchain.CurrentHeader().GetNumberU64(); i++ {
+ for i := uint64(0); i <= pm.blockchain.CurrentHeader().Number.Uint64(); i++ {
bhash := core.GetCanonicalHash(db, i)
if req := fn(ldb, bhash, i); req != nil {
ctx, _ := context.WithTimeout(context.Background(), 200*time.Millisecond)
diff --git a/les/server.go b/les/server.go
index 874586a7e..0f0e2db42 100644
--- a/les/server.go
+++ b/les/server.go
@@ -279,12 +279,12 @@ func (pm *ProtocolManager) blockLoop() {
if len(peers) > 0 {
header := ev.Data.(core.ChainHeadEvent).Block.Header()
hash := header.Hash()
- number := header.GetNumberU64()
+ number := header.Number.Uint64()
td := core.GetTd(pm.chainDb, hash, number)
if td != nil && td.Cmp(lastBroadcastTd) > 0 {
var reorg uint64
if lastHead != nil {
- reorg = lastHead.GetNumberU64() - core.FindCommonAncestor(pm.chainDb, header, lastHead).GetNumberU64()
+ reorg = lastHead.Number.Uint64() - core.FindCommonAncestor(pm.chainDb, header, lastHead).Number.Uint64()
}
lastHead = header
lastBroadcastTd = td