mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
Simplify TryLowWorkHeadersSync invocation
Make use of the fact that now TryLowWorkHeadersSync is (like IsContinuationOfLowWorkHeadersSync) an operation that partially processes headers, so it can be invoked in a similar way, only bailing out when there is nothing left to do.
This commit is contained in:
@@ -2807,14 +2807,14 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, Peer& peer,
|
||||
// At this point, the headers connect to something in our block index.
|
||||
// Do anti-DoS checks to determine if we should process or store for later
|
||||
// processing.
|
||||
if (!already_validated_work && TryLowWorkHeadersSync(peer, pfrom,
|
||||
chain_start_header, headers)) {
|
||||
// If we successfully started a low-work headers sync, then there
|
||||
// should be no headers to process any further.
|
||||
Assume(headers.empty());
|
||||
return;
|
||||
if (!already_validated_work) {
|
||||
already_validated_work = TryLowWorkHeadersSync(peer, pfrom, chain_start_header, headers);
|
||||
have_headers_sync = already_validated_work;
|
||||
}
|
||||
|
||||
// If there is nothing left to process, stop.
|
||||
if (headers.empty()) return;
|
||||
|
||||
// At this point, we have a set of headers with sufficient work on them
|
||||
// which can be processed.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user