Merge pull request #19232 from karalabe/dl-fix-local-drop-sync

eth/downloader: fix nil droppeer in state sync
This commit is contained in:
Péter Szilágyi 2019-03-07 13:06:36 +02:00 committed by GitHub
commit 2eed46dadf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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