Skip to content

Commit 1612267

Browse files
committed
eth/downloader: fix nil droppeer in state sync
1 parent 72b21db commit 1612267

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎eth/downloader/statesync.go‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,13 @@ func (s *stateSync) loop() (err error) {
310310
// 2 items are the minimum requested, if even that times out, we've no use of
311311
// this peer at the moment.
312312
log.Warn("Stalling state sync, dropping peer", "peer", req.peer.id)
313-
s.d.dropPeer(req.peer.id)
313+
if s.d.dropPeer == nil {
314+
// The dropPeer method is nil when `--copydb` is used for a local copy.
315+
// Timeouts can occur if e.g. compaction hits at the wrong time, and can be ignored
316+
req.peer.log.Warn("Downloader wants to drop peer, but peerdrop-function is not set", "peer", req.peer.id)
317+
} else {
318+
s.d.dropPeer(req.peer.id)
319+
}
314320
}
315321
// Process all the received blobs and check for stale delivery
316322
delivered, err := s.process(req)

0 commit comments

Comments
 (0)