Skip to content

Commit

Permalink
eth/fetcher: avoid spurious timer events at startup (#22652)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Lange <fjl@twurst.com>
  • Loading branch information
r1cs and fjl authored Apr 14, 2021
1 parent 72e3794 commit a50251e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions eth/fetcher/block_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,12 @@ func (f *BlockFetcher) FilterBodies(peer string, transactions [][]*types.Transac
// events.
func (f *BlockFetcher) loop() {
// Iterate the block fetching until a quit is requested
fetchTimer := time.NewTimer(0)
completeTimer := time.NewTimer(0)
var (
fetchTimer = time.NewTimer(0)
completeTimer = time.NewTimer(0)
)
<-fetchTimer.C // clear out the channel
<-completeTimer.C
defer fetchTimer.Stop()
defer completeTimer.Stop()

Expand Down

0 comments on commit a50251e

Please sign in to comment.