Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Commit b0f0f35

Browse files
Smilenatoracud
authored andcommitted
eth/fetcher: reuse variables for hash and number (#16819)
1 parent 7baae2c commit b0f0f35

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

eth/fetcher/fetcher.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,20 +292,20 @@ func (f *Fetcher) loop() {
292292
height := f.chainHeight()
293293
for !f.queue.Empty() {
294294
op := f.queue.PopItem().(*inject)
295+
hash := op.block.Hash()
295296
if f.queueChangeHook != nil {
296-
f.queueChangeHook(op.block.Hash(), false)
297+
f.queueChangeHook(hash, false)
297298
}
298299
// If too high up the chain or phase, continue later
299300
number := op.block.NumberU64()
300301
if number > height+1 {
301-
f.queue.Push(op, -float32(op.block.NumberU64()))
302+
f.queue.Push(op, -float32(number))
302303
if f.queueChangeHook != nil {
303-
f.queueChangeHook(op.block.Hash(), true)
304+
f.queueChangeHook(hash, true)
304305
}
305306
break
306307
}
307308
// Otherwise if fresh and still unknown, try and import
308-
hash := op.block.Hash()
309309
if number+maxUncleDist < height || f.getBlock(hash) != nil {
310310
f.forgetBlock(hash)
311311
continue

0 commit comments

Comments
 (0)