diff options
author | dergoegge <n.goeggi@gmail.com> | 2022-10-26 11:11:36 +0100 |
---|---|---|
committer | dergoegge <n.goeggi@gmail.com> | 2022-10-26 11:12:03 +0100 |
commit | 784b02319128988038d4bd82f05736be22f14ee9 (patch) | |
tree | ef92bd2f7869d83b856b2d9fb7eeb8a1090a0346 /src | |
parent | e891aabf5a4992a65b9c5ae8606f8dd08515b310 (diff) | |
download | bitcoin-784b02319128988038d4bd82f05736be22f14ee9.tar.xz |
[net processing] Simplify use of IsContinuationOfLowWorkHeadersSync in TryLowWorkHeaderSync
`m_headers_sync` is already reset in IsContinuationOfLowWorkHeadersSync
if there is a failure, so there is no need to also reset in
TryLowWorkHeaderSync.
Diffstat (limited to 'src')
-rw-r--r-- | src/net_processing.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 544acede03..4774d58d37 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2562,14 +2562,10 @@ bool PeerManagerImpl::TryLowWorkHeadersSync(Peer& peer, CNode& pfrom, const CBlo peer.m_headers_sync.reset(new HeadersSyncState(peer.m_id, m_chainparams.GetConsensus(), chain_start_header, minimum_chain_work)); - // Now a HeadersSyncState object for tracking this synchronization is created, - // process the headers using it as normal. - if (!IsContinuationOfLowWorkHeadersSync(peer, pfrom, headers)) { - // Something went wrong, reset the headers sync. - peer.m_headers_sync.reset(nullptr); - LOCK(m_headers_presync_mutex); - m_headers_presync_stats.erase(peer.m_id); - } + // Now a HeadersSyncState object for tracking this synchronization + // is created, process the headers using it as normal. Failures are + // handled inside of IsContinuationOfLowWorkHeadersSync. + (void)IsContinuationOfLowWorkHeadersSync(peer, pfrom, headers); } else { LogPrint(BCLog::NET, "Ignoring low-work chain (height=%u) from peer=%d\n", chain_start_header->nHeight + headers.size(), pfrom.GetId()); } |