@@ -2690,8 +2690,8 @@ bool PeerManagerImpl::IsContinuationOfLowWorkHeadersSync(Peer& peer, CNode& pfro
26902690
26912691bool PeerManagerImpl::TryLowWorkHeadersSync (Peer& peer, CNode& pfrom, const CBlockIndex* chain_start_header, std::vector<CBlockHeader>& headers)
26922692{
2693- // Calculate the total work on this chain.
2694- arith_uint256 total_work = chain_start_header->nChainWork + CalculateHeadersWork (headers);
2693+ // Calculate the claimed total work on this chain.
2694+ arith_uint256 total_work = chain_start_header->nChainWork + CalculateClaimedHeadersWork (headers);
26952695
26962696 // Our dynamic anti-DoS threshold (minimum work required on a headers chain
26972697 // before we'll store it)
@@ -4424,7 +4424,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
44244424 MaybeSendGetHeaders (pfrom, GetLocator (m_chainman.m_best_header ), *peer);
44254425 }
44264426 return ;
4427- } else if (prev_block->nChainWork + CalculateHeadersWork ({cmpctblock.header }) < GetAntiDoSWorkThreshold ()) {
4427+ } else if (prev_block->nChainWork + CalculateClaimedHeadersWork ({cmpctblock.header }) < GetAntiDoSWorkThreshold ()) {
44284428 // If we get a low-work header in a compact block, we can ignore it.
44294429 LogPrint (BCLog::NET, " Ignoring low-work compact block from peer %d\n " , pfrom.GetId ());
44304430 return ;
@@ -4744,8 +4744,8 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
47444744 // cs_main in ProcessNewBlock is fine.
47454745 mapBlockSource.emplace (hash, std::make_pair (pfrom.GetId (), true ));
47464746
4747- // Check work on this block against our anti-dos thresholds.
4748- if (prev_block && prev_block->nChainWork + CalculateHeadersWork ({pblock->GetBlockHeader ()}) >= GetAntiDoSWorkThreshold ()) {
4747+ // Check claimed work on this block against our anti-dos thresholds.
4748+ if (prev_block && prev_block->nChainWork + CalculateClaimedHeadersWork ({pblock->GetBlockHeader ()}) >= GetAntiDoSWorkThreshold ()) {
47494749 min_pow_checked = true ;
47504750 }
47514751 }
0 commit comments