aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmilenator <yurivanenko@yandex.ru>2018-05-29 15:57:08 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-05-29 15:57:08 +0800
commit40a2c523975d8bf74a0f64c09e628c4f95319376 (patch)
tree7f9628e821d6d56b4916c9241cbc21bc3653d89c
parenta9c6ef6905261bd25c4a2d14bf13b093ad6444fd (diff)
downloaddexon-40a2c523975d8bf74a0f64c09e628c4f95319376.tar
dexon-40a2c523975d8bf74a0f64c09e628c4f95319376.tar.gz
dexon-40a2c523975d8bf74a0f64c09e628c4f95319376.tar.bz2
dexon-40a2c523975d8bf74a0f64c09e628c4f95319376.tar.lz
dexon-40a2c523975d8bf74a0f64c09e628c4f95319376.tar.xz
dexon-40a2c523975d8bf74a0f64c09e628c4f95319376.tar.zst
dexon-40a2c523975d8bf74a0f64c09e628c4f95319376.zip
eth/fetcher: reuse variables for hash and number (#16819)
-rw-r--r--eth/fetcher/fetcher.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go
index 0c679cec3..a2e7cdecf 100644
--- a/eth/fetcher/fetcher.go
+++ b/eth/fetcher/fetcher.go
@@ -292,20 +292,20 @@ func (f *Fetcher) loop() {
height := f.chainHeight()
for !f.queue.Empty() {
op := f.queue.PopItem().(*inject)
+ hash := op.block.Hash()
if f.queueChangeHook != nil {
- f.queueChangeHook(op.block.Hash(), false)
+ f.queueChangeHook(hash, false)
}
// If too high up the chain or phase, continue later
number := op.block.NumberU64()
if number > height+1 {
- f.queue.Push(op, -float32(op.block.NumberU64()))
+ f.queue.Push(op, -float32(number))
if f.queueChangeHook != nil {
- f.queueChangeHook(op.block.Hash(), true)
+ f.queueChangeHook(hash, true)
}
break
}
// Otherwise if fresh and still unknown, try and import
- hash := op.block.Hash()
if number+maxUncleDist < height || f.getBlock(hash) != nil {
f.forgetBlock(hash)
continue