diff --git a/blockmanager.go b/blockmanager.go index 84c29886..3d3d8388 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -163,13 +163,6 @@ func (b *blockManager) handleDonePeerMsg(peers *list.List, p *peer) { log.Infof("[BMGR] Lost peer %s", p) - // Attempt to find a new peer to sync from if the quitting peer is the - // sync peer. - if b.syncPeer != nil && b.syncPeer == p { - b.syncPeer = nil - b.startSync(peers) - } - // remove requested blocks from the global map so that they will be // fetched from elsewhere next time we get an inv. // TODO(oga) we could possibly here check which peers have these blocks @@ -177,6 +170,13 @@ func (b *blockManager) handleDonePeerMsg(peers *list.List, p *peer) { for k := range p.requestedBlocks { delete(b.requestedBlocks, k) } + + // Attempt to find a new peer to sync from if the quitting peer is the + // sync peer. + if b.syncPeer != nil && b.syncPeer == p { + b.syncPeer = nil + b.startSync(peers) + } } // logBlockHeight logs a new block height as an information message to show