Skip to content

Commit 0ed9cc5

Browse files
committed
doc: clarify -i2pacceptincoming help documentation
and also hoist the default setting to a constexpr and remove unused f-string operators in a related functional test.
1 parent b4fb0a3 commit 0ed9cc5

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

doc/i2p.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ Core configuration options:
3333
none)
3434
3535
-i2pacceptincoming
36-
If set and -i2psam is also set then incoming I2P connections are
37-
accepted via the SAM proxy. If this is not set but -i2psam is set
38-
then only outgoing connections will be made to the I2P network.
39-
Ignored if -i2psam is not set. Listening for incoming I2P
40-
connections is done through the SAM proxy, not by binding to a
41-
local address and port (default: 1)
36+
Whether to accept inbound I2P connections (default: 1). Ignored if
37+
-i2psam is not set. Listening for inbound I2P connections is
38+
done through the SAM proxy, not by binding to a local address and
39+
port.
4240
```
4341

4442
In a typical situation, this suffices:

src/init.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ using node::fPruneMode;
126126
using node::fReindex;
127127
using node::nPruneTarget;
128128

129-
static const bool DEFAULT_PROXYRANDOMIZE = true;
130-
static const bool DEFAULT_REST_ENABLE = false;
129+
static constexpr bool DEFAULT_PROXYRANDOMIZE{true};
130+
static constexpr bool DEFAULT_REST_ENABLE{false};
131+
static constexpr bool DEFAULT_I2P_ACCEPT_INCOMING{true};
131132

132133
#ifdef WIN32
133134
// Win32 LevelDB doesn't use filedescriptors, and the ones used for
@@ -473,7 +474,7 @@ void SetupServerArgs(ArgsManager& argsman)
473474
argsman.AddArg("-maxuploadtarget=<n>", strprintf("Tries to keep outbound traffic under the given target per 24h. Limit does not apply to peers with 'download' permission or blocks created within past week. 0 = no limit (default: %s). Optional suffix units [k|K|m|M|g|G|t|T] (default: M). Lowercase is 1000 base while uppercase is 1024 base", DEFAULT_MAX_UPLOAD_TARGET), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
474475
argsman.AddArg("-onion=<ip:port>", "Use separate SOCKS5 proxy to reach peers via Tor onion services, set -noonion to disable (default: -proxy)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
475476
argsman.AddArg("-i2psam=<ip:port>", "I2P SAM proxy to reach I2P peers and accept I2P connections (default: none)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
476-
argsman.AddArg("-i2pacceptincoming", "If set and -i2psam is also set then incoming I2P connections are accepted via the SAM proxy. If this is not set but -i2psam is set then only outgoing connections will be made to the I2P network. Ignored if -i2psam is not set. Listening for incoming I2P connections is done through the SAM proxy, not by binding to a local address and port (default: 1)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
477+
argsman.AddArg("-i2pacceptincoming", strprintf("Whether to accept inbound I2P connections (default: %i). Ignored if -i2psam is not set. Listening for inbound I2P connections is done through the SAM proxy, not by binding to a local address and port.", DEFAULT_I2P_ACCEPT_INCOMING), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
477478
argsman.AddArg("-onlynet=<net>", "Make automatic outbound connections only to network <net> (" + Join(GetNetworkNames(), ", ") + "). Inbound and manual connections are not affected by this option. It can be specified multiple times to allow multiple networks.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
478479
argsman.AddArg("-peerbloomfilters", strprintf("Support filtering of blocks and transaction with bloom filters (default: %u)", DEFAULT_PEERBLOOMFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
479480
argsman.AddArg("-peerblockfilters", strprintf("Serve compact block filters to peers per BIP 157 (default: %u)", DEFAULT_PEERBLOCKFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
@@ -1829,7 +1830,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
18291830
SetReachable(NET_I2P, false);
18301831
}
18311832

1832-
connOptions.m_i2p_accept_incoming = args.GetBoolArg("-i2pacceptincoming", true);
1833+
connOptions.m_i2p_accept_incoming = args.GetBoolArg("-i2pacceptincoming", DEFAULT_I2P_ACCEPT_INCOMING);
18331834

18341835
if (!node.connman->Start(*node.scheduler, connOptions)) {
18351836
return false;

test/functional/p2p_i2p_sessions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ def run_test(self):
2323

2424
self.log.info("Ensure we create a persistent session when -i2pacceptincoming=1")
2525
node0 = self.nodes[0]
26-
with node0.assert_debug_log(expected_msgs=[f"Creating persistent SAM session"]):
26+
with node0.assert_debug_log(expected_msgs=["Creating persistent SAM session"]):
2727
node0.addnode(node=addr, command="onetry")
2828

2929
self.log.info("Ensure we create a transient session when -i2pacceptincoming=0")
3030
node1 = self.nodes[1]
31-
with node1.assert_debug_log(expected_msgs=[f"Creating transient SAM session"]):
31+
with node1.assert_debug_log(expected_msgs=["Creating transient SAM session"]):
3232
node1.addnode(node=addr, command="onetry")
3333

3434

0 commit comments

Comments
 (0)