mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
Merge bitcoin/bitcoin#26899: p2p: set -dnsseed
and -listen
false if maxconnections=0
fabb95e7bf
doc: add release note for 26899 (brunoerg)c84c5f6e89
p2p: set `-dnsseed` and `-listen` false if `maxconnections=0` (brunoerg) Pull request description: If `maxconnections=0`, it means our possible connections are going to be manual (e.g via `addnode`). For this reason, we can skip DNS seeds and set `listen` false. ACKs for top commit: achow101: ACKfabb95e7bf
vasild: ACKfabb95e7bf
1440000bytes: reACKfabb95e7bf
Tree-SHA512: 33919a784723a32450f39ee4f6de3e27cc7c7f4c6ab4b8ce673981d461df334197deaf43e3f882039fa1ac36b2fddc6c6ab4413512d6c393d4a6865302dd05e7
This commit is contained in:
commit
b7edd55c22
2 changed files with 10 additions and 5 deletions
5
doc/release-notes-26899.md
Normal file
5
doc/release-notes-26899.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
Updated settings
|
||||
----------------
|
||||
|
||||
- Setting `-maxconnections=0` will now disable `-dnsseed`
|
||||
and `-listen` (users may still set them to override).
|
10
src/init.cpp
10
src/init.cpp
|
@ -472,11 +472,11 @@ void SetupServerArgs(ArgsManager& argsman)
|
|||
argsman.AddArg("-connect=<ip>", "Connect only to the specified node; -noconnect disables automatic connections (the rules for this peer are the same as for -addnode). This option can be specified multiple times to connect to multiple nodes.", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-discover", "Discover own IP addresses (default: 1 when listening and no -externalip or -proxy)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-dns", strprintf("Allow DNS lookups for -addnode, -seednode and -connect (default: %u)", DEFAULT_NAME_LOOKUP), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-dnsseed", strprintf("Query for peer addresses via DNS lookup, if low on addresses (default: %u unless -connect used)", DEFAULT_DNSSEED), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-dnsseed", strprintf("Query for peer addresses via DNS lookup, if low on addresses (default: %u unless -connect used or -maxconnections=0)", DEFAULT_DNSSEED), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-externalip=<ip>", "Specify your own public address", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-fixedseeds", strprintf("Allow fixed seeds if DNS seeds don't provide peers (default: %u)", DEFAULT_FIXEDSEEDS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-forcednsseed", strprintf("Always query for peer addresses via DNS lookup (default: %u)", DEFAULT_FORCEDNSSEED), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-listen", strprintf("Accept connections from outside (default: %u if no -proxy or -connect)", DEFAULT_LISTEN), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-listen", strprintf("Accept connections from outside (default: %u if no -proxy, -connect or -maxconnections=0)", DEFAULT_LISTEN), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-listenonion", strprintf("Automatically create Tor onion service (default: %d)", DEFAULT_LISTEN_ONION), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-maxconnections=<n>", strprintf("Maintain at most <n> connections to peers (default: %u). This limit does not apply to connections manually added via -addnode or the addnode RPC, which have a separate limit of %u.", DEFAULT_MAX_PEER_CONNECTIONS, MAX_ADDNODE_CONNECTIONS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
argsman.AddArg("-maxreceivebuffer=<n>", strprintf("Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)", DEFAULT_MAXRECEIVEBUFFER), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
|
@ -683,12 +683,12 @@ void InitParameterInteraction(ArgsManager& args)
|
|||
LogPrintf("%s: parameter interaction: -whitebind set -> setting -listen=1\n", __func__);
|
||||
}
|
||||
|
||||
if (args.IsArgSet("-connect")) {
|
||||
if (args.IsArgSet("-connect") || args.GetIntArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS) <= 0) {
|
||||
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
|
||||
if (args.SoftSetBoolArg("-dnsseed", false))
|
||||
LogPrintf("%s: parameter interaction: -connect set -> setting -dnsseed=0\n", __func__);
|
||||
LogPrintf("%s: parameter interaction: -connect or -maxconnections=0 set -> setting -dnsseed=0\n", __func__);
|
||||
if (args.SoftSetBoolArg("-listen", false))
|
||||
LogPrintf("%s: parameter interaction: -connect set -> setting -listen=0\n", __func__);
|
||||
LogPrintf("%s: parameter interaction: -connect or -maxconnections=0 set -> setting -listen=0\n", __func__);
|
||||
}
|
||||
|
||||
std::string proxy_arg = args.GetArg("-proxy", "");
|
||||
|
|
Loading…
Reference in a new issue