mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 18:52:29 +02:00
Add comment explaining forced processing of compact blocks
Github-Pull: #11458
Rebased-From: 01b52cedd4
This commit is contained in:
committed by
MarcoFalke
parent
2df65eeb98
commit
ffb6ea4e5e
@@ -2144,7 +2144,16 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
mapBlockSource.emplace(pblock->GetHash(), std::make_pair(pfrom->GetId(), false));
|
mapBlockSource.emplace(pblock->GetHash(), std::make_pair(pfrom->GetId(), false));
|
||||||
}
|
}
|
||||||
bool fNewBlock = false;
|
bool fNewBlock = false;
|
||||||
ProcessNewBlock(chainparams, pblock, true, &fNewBlock);
|
// Setting fForceProcessing to true means that we bypass some of
|
||||||
|
// our anti-DoS protections in AcceptBlock, which filters
|
||||||
|
// unrequested blocks that might be trying to waste our resources
|
||||||
|
// (eg disk space). Because we only try to reconstruct blocks when
|
||||||
|
// we're close to caught up (via the CanDirectFetch() requirement
|
||||||
|
// above, combined with the behavior of not requesting blocks until
|
||||||
|
// we have a chain with at least nMinimumChainWork), and we ignore
|
||||||
|
// compact blocks with less work than our tip, it is safe to treat
|
||||||
|
// reconstructed compact blocks as having been requested.
|
||||||
|
ProcessNewBlock(chainparams, pblock, /*fForceProcessing=*/true, &fNewBlock);
|
||||||
if (fNewBlock) {
|
if (fNewBlock) {
|
||||||
pfrom->nLastBlockTime = GetTime();
|
pfrom->nLastBlockTime = GetTime();
|
||||||
} else {
|
} else {
|
||||||
@@ -2224,7 +2233,11 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
bool fNewBlock = false;
|
bool fNewBlock = false;
|
||||||
// Since we requested this block (it was in mapBlocksInFlight), force it to be processed,
|
// Since we requested this block (it was in mapBlocksInFlight), force it to be processed,
|
||||||
// even if it would not be a candidate for new tip (missing previous block, chain not long enough, etc)
|
// even if it would not be a candidate for new tip (missing previous block, chain not long enough, etc)
|
||||||
ProcessNewBlock(chainparams, pblock, true, &fNewBlock);
|
// This bypasses some anti-DoS logic in AcceptBlock (eg to prevent
|
||||||
|
// disk-space attacks), but this should be safe due to the
|
||||||
|
// protections in the compact block handler -- see related comment
|
||||||
|
// in compact block optimistic reconstruction handling.
|
||||||
|
ProcessNewBlock(chainparams, pblock, /*fForceProcessing=*/true, &fNewBlock);
|
||||||
if (fNewBlock) {
|
if (fNewBlock) {
|
||||||
pfrom->nLastBlockTime = GetTime();
|
pfrom->nLastBlockTime = GetTime();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user