Skip to content

Commit d2e987a

Browse files
committed
Merge pull request #6958
9c3ee3b [doc] Add -maxuploadtarget release notes (MarcoFalke) b27e81f [net] Cleanup maxuploadtarget (MarcoFalke)
2 parents 24c4841 + 9c3ee3b commit d2e987a

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

doc/release-notes.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,25 @@ a connection to Tor can be made. It can be configured with the `-listenonion`,
168168
`-torcontrol` and `-torpassword` settings. To show verbose debugging
169169
information, pass `-debug=tor`.
170170

171+
Reduce upload traffic
172+
---------------------
173+
174+
A major part of the outbound traffic is caused by serving historic blocks to
175+
other nodes in initial block download state.
176+
177+
It is now possible to reduce the total upload traffic via the `-maxuploadtarget`
178+
parameter. This is *not* a hard limit but a threshold to minimize the outbound
179+
traffic. When the limit is about to be reached, the uploaded data is cut by not
180+
serving historic blocks (blocks older than one week).
181+
Moreover, any SPV peer is disconnected when they request a filtered block.
182+
183+
This option can be specified in MiB per day and is turned off by default
184+
(`-maxuploadtarget=0`).
185+
The recommended minimum is 144 * MAX_BLOCK_SIZE (currently 144MB) per day.
186+
187+
A more detailed documentation about keeping traffic low can be found in
188+
[/doc/reducetraffic.md](/doc/reducetraffic.md).
189+
171190
0.12.0 Change log
172191
=================
173192

qa/rpc-tests/maxuploadtarget.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ def run_test(self):
192192
getdata_request.inv.append(CInv(2, big_old_block))
193193

194194
max_bytes_per_day = 200*1024*1024
195-
max_bytes_available = max_bytes_per_day - 144*1000000
195+
daily_buffer = 144 * 1000000
196+
max_bytes_available = max_bytes_per_day - daily_buffer
196197
success_count = max_bytes_available / old_block_size
197198

198199
# 144MB will be reserved for relaying new blocks, so expect this to

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ std::string HelpMessage(HelpMessageMode mode)
375375
strUsage += HelpMessageOpt("-whitebind=<addr>", _("Bind to given address and whitelist peers connecting to it. Use [host]:port notation for IPv6"));
376376
strUsage += HelpMessageOpt("-whitelist=<netmask>", _("Whitelist peers connecting from the given netmask or IP address. Can be specified multiple times.") +
377377
" " + _("Whitelisted peers cannot be DoS banned and their transactions are always relayed, even if they are already in the mempool, useful e.g. for a gateway"));
378-
strUsage += HelpMessageOpt("-maxuploadtarget=<n>", strprintf(_("Tries to keep outbound traffic under the given target (in MiB per 24h), 0 = no limit (default: %d)"), 0));
378+
strUsage += HelpMessageOpt("-maxuploadtarget=<n>", strprintf(_("Tries to keep outbound traffic under the given target (in MiB per 24h), 0 = no limit (default: %d)"), DEFAULT_MAX_UPLOAD_TARGET));
379379

380380
#ifdef ENABLE_WALLET
381381
strUsage += HelpMessageGroup(_("Wallet options:"));
@@ -1193,7 +1193,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
11931193
}
11941194
#endif
11951195
if (mapArgs.count("-maxuploadtarget")) {
1196-
CNode::SetMaxOutboundTarget(GetArg("-maxuploadtarget", 0)*1024*1024);
1196+
CNode::SetMaxOutboundTarget(GetArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET)*1024*1024);
11971197
}
11981198

11991199
// ********************************************************* Step 7: load block chain

src/net.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,8 +2117,8 @@ void CNode::SetMaxOutboundTarget(uint64_t limit)
21172117
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SIZE;
21182118
nMaxOutboundLimit = limit;
21192119

2120-
if (limit < recommendedMinimum)
2121-
LogPrintf("Max outbound target is very small (%s) and will be overshot. Recommended minimum is %s\n.", nMaxOutboundLimit, recommendedMinimum);
2120+
if (limit > 0 && limit < recommendedMinimum)
2121+
LogPrintf("Max outbound target is very small (%s bytes) and will be overshot. Recommended minimum is %s bytes.\n", nMaxOutboundLimit, recommendedMinimum);
21222122
}
21232123

21242124
uint64_t CNode::GetMaxOutboundTarget()

src/net.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ static const bool DEFAULT_UPNP = false;
6060
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
6161
/** The maximum number of peer connections to maintain. */
6262
static const unsigned int DEFAULT_MAX_PEER_CONNECTIONS = 125;
63+
/** The default for -maxuploadtarget. 0 = Unlimited */
64+
static const uint64_t DEFAULT_MAX_UPLOAD_TARGET = 0;
6365

6466
unsigned int ReceiveFloodSize();
6567
unsigned int SendBufferSize();

0 commit comments

Comments
 (0)