eth/fetcher: avoid spurious timer events at startup (#22652)

Co-authored-by: Felix Lange <fjl@twurst.com>
pull/22666/head
xD AKA Rapper King Of cn background diablo & revelations 4 years ago committed by GitHub
parent 72e37942f3
commit a50251e6cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      eth/fetcher/block_fetcher.go

@ -331,8 +331,12 @@ func (f *BlockFetcher) FilterBodies(peer string, transactions [][]*types.Transac
// events. // events.
func (f *BlockFetcher) loop() { func (f *BlockFetcher) loop() {
// Iterate the block fetching until a quit is requested // Iterate the block fetching until a quit is requested
fetchTimer := time.NewTimer(0) var (
completeTimer := time.NewTimer(0) fetchTimer = time.NewTimer(0)
completeTimer = time.NewTimer(0)
)
<-fetchTimer.C // clear out the channel
<-completeTimer.C
defer fetchTimer.Stop() defer fetchTimer.Stop()
defer completeTimer.Stop() defer completeTimer.Stop()

Loading…
Cancel
Save