init: Pass post-Blossom spacing into CNode::SetMaxOutboundTarget()

This commit is contained in:
Jack Grigg 2020-08-13 21:17:51 +01:00 committed by Kris Nuttycombe
parent 0f66b1e138
commit 51ae7a0ae5
3 changed files with 6 additions and 4 deletions

View File

@ -1376,7 +1376,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
#endif
if (mapArgs.count("-maxuploadtarget")) {
CNode::SetMaxOutboundTarget(GetArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET)*1024*1024);
CNode::SetMaxOutboundTarget(
chainparams.GetConsensus().nPostBlossomPowTargetSpacing,
GetArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET)*1024*1024);
}
// ********************************************************* Step 7: load block chain

View File

@ -2020,10 +2020,10 @@ void CNode::RecordBytesSent(uint64_t bytes)
nMaxOutboundTotalBytesSentInCycle += bytes;
}
void CNode::SetMaxOutboundTarget(uint64_t limit)
void CNode::SetMaxOutboundTarget(uint64_t targetSpacing, uint64_t limit)
{
LOCK(cs_totalBytesSent);
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SIZE;
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / targetSpacing) * MAX_BLOCK_SIZE;
nMaxOutboundLimit = limit;
if (limit > 0 && limit < recommendedMinimum)

View File

@ -675,7 +675,7 @@ public:
static uint64_t GetTotalBytesSent();
//!set the max outbound target in bytes
static void SetMaxOutboundTarget(uint64_t limit);
static void SetMaxOutboundTarget(uint64_t targetSpacing, uint64_t limit);
static uint64_t GetMaxOutboundTarget();
//!set the timeframe for the max outbound target