Skip to content

Commit

Permalink
fixup! netsync: don't reset the requestedBlocks in headersFirst
Browse files Browse the repository at this point in the history
  • Loading branch information
kcalvinalvin committed Sep 5, 2024
1 parent c386ee0 commit c51d31a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions netsync/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,6 @@ func (sm *SyncManager) startSync() {

// Start syncing from the best peer if one was selected.
if bestPeer != nil {
if !sm.headersFirstMode {
// Clear the requestedBlocks if the sync peer changes, otherwise
// we may ignore blocks we need that the last sync peer failed
// to send.
sm.requestedBlocks = make(map[chainhash.Hash]struct{})
}
locator, err := sm.chain.LatestBlockLocator()
if err != nil {
log.Errorf("Failed to get block locator for the "+
Expand Down Expand Up @@ -452,6 +446,10 @@ func (sm *SyncManager) startSync() {
"%d from peer %s", best.Height+1,
sm.nextCheckpoint.Height, bestPeer.Addr())
} else {
// Clear the requestedBlocks if the sync peer changes, otherwise
// we may ignore blocks we need that the last sync peer failed
// to send.
sm.requestedBlocks = make(map[chainhash.Hash]struct{})
bestPeer.PushGetBlocksMsg(locator, &zeroHash)
}
sm.syncPeer = bestPeer
Expand Down

0 comments on commit c51d31a

Please sign in to comment.