Skip to content

Commit d2ce6d3

Browse files
committed
Fix maxuploadtarget recommended minimum calculation
1 parent 37e77c1 commit d2ce6d3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

doc/reduce-traffic.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ This is *not* a hard limit; only a threshold to minimize the outbound
1919
traffic. When the limit is about to be reached, the uploaded data is cut by no
2020
longer serving historic blocks (blocks older than one week).
2121
Keep in mind that new nodes require other nodes that are willing to serve
22-
historic blocks. **The recommended minimum is 144 blocks per day (max. 144MB
23-
per day)**
22+
historic blocks.
23+
**The current recommended minimum is 288MiB, assuming an average serialized block size of 2MB.**
2424

2525
Whitelisted peers will never be disconnected, although their traffic counts for
2626
calculating the target.

src/net.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,11 +2193,12 @@ void CNode::RecordBytesSent(uint64_t bytes)
21932193
void CNode::SetMaxOutboundTarget(uint64_t limit)
21942194
{
21952195
LOCK(cs_totalBytesSent);
2196-
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SERIALIZED_SIZE;
2196+
// assume the average size of serialized blocks is half the maximum
2197+
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SERIALIZED_SIZE / 2;
21972198
nMaxOutboundLimit = limit;
21982199

21992200
if (limit > 0 && limit < recommendedMinimum)
2200-
LogPrintf("Max outbound target is very small (%s bytes) and will be overshot. Recommended minimum is %s bytes.\n", nMaxOutboundLimit, recommendedMinimum);
2201+
LogPrintf("Max outbound target is very small (%s MiB) and will be overshot. Recommended minimum is %s MiB.\n", nMaxOutboundLimit/1024.0/1024.0, recommendedMinimum/1024.0/1024.0);
22012202
}
22022203

22032204
uint64_t CNode::GetMaxOutboundTarget()

0 commit comments

Comments
 (0)