Remove peers from duplicate map *before* we restart sync.

Just in case this ordering causes problems.
This commit is contained in:
Owain G. Ainsworth 2013-10-03 17:59:34 +01:00
parent 6bb0b80bbb
commit 182c4d9ee6

View file

@ -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