Skip to content

Commit 7f1cf44

Browse files
committed
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.
1 parent ab52fb4 commit 7f1cf44

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/net_processing.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,14 +2807,14 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, Peer& peer,
28072807
// At this point, the headers connect to something in our block index.
28082808
// Do anti-DoS checks to determine if we should process or store for later
28092809
// processing.
2810-
if (!already_validated_work && TryLowWorkHeadersSync(peer, pfrom,
2811-
chain_start_header, headers)) {
2812-
// If we successfully started a low-work headers sync, then there
2813-
// should be no headers to process any further.
2814-
Assume(headers.empty());
2815-
return;
2810+
if (!already_validated_work) {
2811+
already_validated_work = TryLowWorkHeadersSync(peer, pfrom, chain_start_header, headers);
2812+
have_headers_sync = already_validated_work;
28162813
}
28172814

2815+
// If there is nothing left to process, stop.
2816+
if (headers.empty()) return;
2817+
28182818
// At this point, we have a set of headers with sufficient work on them
28192819
// which can be processed.
28202820

0 commit comments

Comments
 (0)