Skip to content

Commit c51d31a

Browse files
committed
fixup! netsync: don't reset the requestedBlocks in headersFirst
1 parent c386ee0 commit c51d31a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

netsync/manager.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,6 @@ func (sm *SyncManager) startSync() {
409409

410410
// Start syncing from the best peer if one was selected.
411411
if bestPeer != nil {
412-
if !sm.headersFirstMode {
413-
// Clear the requestedBlocks if the sync peer changes, otherwise
414-
// we may ignore blocks we need that the last sync peer failed
415-
// to send.
416-
sm.requestedBlocks = make(map[chainhash.Hash]struct{})
417-
}
418412
locator, err := sm.chain.LatestBlockLocator()
419413
if err != nil {
420414
log.Errorf("Failed to get block locator for the "+
@@ -452,6 +446,10 @@ func (sm *SyncManager) startSync() {
452446
"%d from peer %s", best.Height+1,
453447
sm.nextCheckpoint.Height, bestPeer.Addr())
454448
} else {
449+
// Clear the requestedBlocks if the sync peer changes, otherwise
450+
// we may ignore blocks we need that the last sync peer failed
451+
// to send.
452+
sm.requestedBlocks = make(map[chainhash.Hash]struct{})
455453
bestPeer.PushGetBlocksMsg(locator, &zeroHash)
456454
}
457455
sm.syncPeer = bestPeer

0 commit comments

Comments
 (0)