From 182c4d9ee676fa3ad84440f52ee519edc0374bab Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Thu, 3 Oct 2013 17:59:34 +0100 Subject: [PATCH] Remove peers from duplicate map *before* we restart sync. Just in case this ordering causes problems. --- blockmanager.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/blockmanager.go b/blockmanager.go index 84c298861..3d3d83883 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