Skip to content

Commit e265200

Browse files
committed
Delay parallel block download until chain has sufficient work
nMinimumChainWork is an anti-DoS threshold; wait until we have a proposed tip with more work than that before downloading blocks towards that tip.
1 parent 6a796b2 commit e265200

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/net_processing.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<con
480480
// Make sure pindexBestKnownBlock is up to date, we'll need it.
481481
ProcessBlockAvailability(nodeid);
482482

483-
if (state->pindexBestKnownBlock == NULL || state->pindexBestKnownBlock->nChainWork < chainActive.Tip()->nChainWork) {
483+
if (state->pindexBestKnownBlock == NULL || state->pindexBestKnownBlock->nChainWork < chainActive.Tip()->nChainWork || state->pindexBestKnownBlock->nChainWork < UintToArith256(consensusParams.nMinimumChainWork)) {
484484
// This peer has nothing interesting.
485485
return;
486486
}

0 commit comments

Comments
 (0)