Skip to content

Commit

Permalink
eth/fetcher: avoid spurious timer events at startup (ethereum#22652)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Lange <[email protected]>
  • Loading branch information
2 people authored and atif-konasl committed Oct 15, 2021
1 parent 16dd0d8 commit 0d42d32
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 0d42d32

Please sign in to comment.