Skip to content

Commit fa9604c

Browse files
author
MarcoFalke
committed
doc: noban precludes maxuploadtarget disconnects
1 parent fa3999f commit fa9604c

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

doc/reduce-traffic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ longer serving historic blocks (blocks older than one week).
2323
Keep in mind that new nodes require other nodes that are willing to serve
2424
historic blocks.
2525

26-
Whitelisted peers will never be disconnected, although their traffic counts for
26+
Peers with the `noban` permission will never be disconnected, although their traffic counts for
2727
calculating the target.
2828

2929
## 2. Disable "listening" (`-listen=0`)

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ void SetupServerArgs(NodeContext& node)
444444
gArgs.AddArg("-maxreceivebuffer=<n>", strprintf("Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)", DEFAULT_MAXRECEIVEBUFFER), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
445445
gArgs.AddArg("-maxsendbuffer=<n>", strprintf("Maximum per-connection send buffer, <n>*1000 bytes (default: %u)", DEFAULT_MAXSENDBUFFER), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
446446
gArgs.AddArg("-maxtimeadjustment", strprintf("Maximum allowed median peer time offset adjustment. Local perspective of time may be influenced by peers forward or backward by this amount. (default: %u seconds)", DEFAULT_MAX_TIME_ADJUSTMENT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
447-
gArgs.AddArg("-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), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
447+
gArgs.AddArg("-maxuploadtarget=<n>", strprintf("Tries to keep outbound traffic under the given target (in MiB per 24h). Limit does not apply to peers with 'noban' permission. 0 = no limit (default: %d)", DEFAULT_MAX_UPLOAD_TARGET), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
448448
gArgs.AddArg("-onion=<ip:port>", "Use separate SOCKS5 proxy to reach peers via Tor hidden services, set -noonion to disable (default: -proxy)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
449449
gArgs.AddArg("-onlynet=<net>", "Make outgoing connections only through network <net> (ipv4, ipv6 or onion). Incoming connections are not affected by this option. This option can be specified multiple times to allow multiple networks.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
450450
gArgs.AddArg("-peerbloomfilters", strprintf("Support filtering of blocks and transaction with bloom filters (default: %u)", DEFAULT_PEERBLOOMFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2639,7 +2639,7 @@ void CConnman::RecordBytesSent(uint64_t bytes)
26392639
nMaxOutboundTotalBytesSentInCycle = 0;
26402640
}
26412641

2642-
// TODO, exclude whitebind peers
2642+
// TODO, exclude peers with noban permission
26432643
nMaxOutboundTotalBytesSentInCycle += bytes;
26442644
}
26452645

src/net_processing.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,11 +1509,10 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
15091509
}
15101510
const CNetMsgMaker msgMaker(pfrom.GetSendVersion());
15111511
// disconnect node in case we have reached the outbound limit for serving historical blocks
1512-
// never disconnect whitelisted nodes
15131512
if (send &&
15141513
connman->OutboundTargetReached(true) &&
15151514
(((pindexBestHeader != nullptr) && (pindexBestHeader->GetBlockTime() - pindex->GetBlockTime() > HISTORICAL_BLOCK_AGE)) || inv.type == MSG_FILTERED_BLOCK) &&
1516-
!pfrom.HasPermission(PF_NOBAN)
1515+
!pfrom.HasPermission(PF_NOBAN) // never disconnect nodes with the noban permission
15171516
) {
15181517
LogPrint(BCLog::NET, "historical block serving limit reached, disconnect peer=%d\n", pfrom.GetId());
15191518

test/functional/feature_maxuploadtarget.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ def run_test(self):
138138
self.nodes[0].disconnect_p2ps()
139139

140140
self.log.info("Restarting node 0 with noban permission and 1MB maxuploadtarget")
141-
self.stop_node(0)
142-
self.start_node(0, ["[email protected]", "-maxuploadtarget=1"])
141+
self.restart_node(0, ["[email protected]", "-maxuploadtarget=1"])
143142

144143
# Reconnect to self.nodes[0]
145144
self.nodes[0].add_p2p_connection(TestP2PConn())
@@ -152,9 +151,9 @@ def run_test(self):
152151

153152
getdata_request.inv = [CInv(MSG_BLOCK, big_old_block)]
154153
self.nodes[0].p2p.send_and_ping(getdata_request)
155-
assert_equal(len(self.nodes[0].getpeerinfo()), 1) #node is still connected because of the whitelist
154+
assert_equal(len(self.nodes[0].getpeerinfo()), 1) #node is still connected because of the noban permission
156155

157-
self.log.info("Peer still connected after trying to download old block (whitelisted)")
156+
self.log.info("Peer still connected after trying to download old block (noban permission)")
158157

159158
if __name__ == '__main__':
160159
MaxUploadTest().main()

0 commit comments

Comments
 (0)