mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
BIP141: Other consensus critical limits, and BIP145
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
This commit is contained in:
@@ -2182,7 +2182,7 @@ void CNode::RecordBytesSent(uint64_t bytes)
|
||||
void CNode::SetMaxOutboundTarget(uint64_t limit)
|
||||
{
|
||||
LOCK(cs_totalBytesSent);
|
||||
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SIZE;
|
||||
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SERIALIZED_SIZE;
|
||||
nMaxOutboundLimit = limit;
|
||||
|
||||
if (limit > 0 && limit < recommendedMinimum)
|
||||
@@ -2237,7 +2237,7 @@ bool CNode::OutboundTargetReached(bool historicalBlockServingLimit)
|
||||
{
|
||||
// keep a large enough buffer to at least relay each block once
|
||||
uint64_t timeLeftInCycle = GetMaxOutboundTimeLeftInCycle();
|
||||
uint64_t buffer = timeLeftInCycle / 600 * MAX_BLOCK_SIZE;
|
||||
uint64_t buffer = timeLeftInCycle / 600 * MAX_BLOCK_SERIALIZED_SIZE;
|
||||
if (buffer >= nMaxOutboundLimit || nMaxOutboundTotalBytesSentInCycle >= nMaxOutboundLimit - buffer)
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user