@@ -638,9 +638,8 @@ class PeerManagerImpl final : public PeerManager
638
638
* @param[in] chain_start_header Where these headers connect in our index.
639
639
* @param[in,out] headers The headers to be processed.
640
640
*
641
- * @return True if chain was low work and a headers sync was
642
- * initiated (and headers will be empty after calling); false
643
- * otherwise.
641
+ * @return True if chain was low work (headers will be empty after
642
+ * calling); false otherwise.
644
643
*/
645
644
bool TryLowWorkHeadersSync (Peer& peer, CNode& pfrom,
646
645
const CBlockIndex* chain_start_header,
@@ -2563,14 +2562,10 @@ bool PeerManagerImpl::TryLowWorkHeadersSync(Peer& peer, CNode& pfrom, const CBlo
2563
2562
peer.m_headers_sync .reset (new HeadersSyncState (peer.m_id , m_chainparams.GetConsensus (),
2564
2563
chain_start_header, minimum_chain_work));
2565
2564
2566
- // Now a HeadersSyncState object for tracking this synchronization is created,
2567
- // process the headers using it as normal.
2568
- if (!IsContinuationOfLowWorkHeadersSync (peer, pfrom, headers)) {
2569
- // Something went wrong, reset the headers sync.
2570
- peer.m_headers_sync .reset (nullptr );
2571
- LOCK (m_headers_presync_mutex);
2572
- m_headers_presync_stats.erase (peer.m_id );
2573
- }
2565
+ // Now a HeadersSyncState object for tracking this synchronization
2566
+ // is created, process the headers using it as normal. Failures are
2567
+ // handled inside of IsContinuationOfLowWorkHeadersSync.
2568
+ (void )IsContinuationOfLowWorkHeadersSync (peer, pfrom, headers);
2574
2569
} else {
2575
2570
LogPrint (BCLog::NET, " Ignoring low-work chain (height=%u) from peer=%d\n " , chain_start_header->nHeight + headers.size (), pfrom.GetId ());
2576
2571
}
0 commit comments