mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-10 14:03:17 +02:00
Merge bitcoin/bitcoin#30529: Fix -norpcwhitelist, -norpcallowip, and similar corner case behavior
a85e8c0e61doc: Add some general documentation about negated options (Ryan Ofsky)490c8fa178doc: Add release notes summarizing negated option behavior changes. (Ryan Ofsky)458ef0a11brefactor: Avoid using IsArgSet() on -connect list option (Ryan Ofsky)752ab9c3c6test: Add test to make sure -noconnect disables -dnsseed and -listen by default (Ryan Ofsky)3c2920ec98refactor: Avoid using IsArgSet() on -signetseednode and -signetchallenge list options (Ryan Ofsky)d05668922arefactor: Avoid using IsArgSet() on -debug, -loglevel, and -vbparams list options (Ryan Ofsky)3d1e8ca53aNormalize inconsistent -noexternalip behavior (Ryan Ofsky)ecd590d4c1Normalize inconsistent -noonlynet behavior (Ryan Ofsky)5544a19f86Fix nonsensical bitcoin-cli -norpcwallet behavior (Ryan Ofsky)6e8e7f433fFix nonsensical -noasmap behavior (Ryan Ofsky)b6ab350806Fix nonsensical -notest behavior (Ryan Ofsky)6768389917Fix nonsensical -norpcwhitelist behavior (Ryan Ofsky)e03409c70fFix nonsensical -norpcbind and -norpcallowip behavior (Ryan Ofsky)40c4899bc2Fix nonsensical -nobind and -nowhitebind behavior (Ryan Ofsky)5453e66fd9Fix nonsensical -noseednode behavior (Ryan Ofsky) Pull request description: The PR changes behavior of negated `-noseednode`, `-nobind`, `-nowhitebind`, `-norpcbind`, `-norpcallowip`, `-norpcwhitelist`, `-notest`, `-noasmap`, `-norpcwallet`, `-noonlynet`, and `-noexternalip` options, so negating these options just clears previously specified values doesn't have other side effects. Negating options on the command line can be a useful way of resetting options that may have been set earlier in the command line or config file. But before this change, negating these options wouldn't fully reset them, and would have confusing and undocumented side effects (see commit descriptions for details). Now, negating these options just resets them and behaves the same as not specifying them. Motivation for this PR is to fix confusing behaviors and also to remove incorrect usages of the `IsArgSet()` function. Using `IsArgSet()` tends to lead to negated option bugs in general, but it especially causes bugs when used with list settings returned by `GetArgs()`, because when these settings are negated, `IsArgSet()` will return true but `GetArgs()` will return an empty list. This PR eliminates all uses of `IsArgSet()` and `GetArgs()` together, and followup PR #17783 makes it an error to use `IsArgSet()` on list settings, since calling `IsArgSet()` is never actually necessary. Most of the changes here were originally made in #17783 and then moved here to be easier to review and avoid a dependency on #16545. ACKs for top commit: achow101: ACKa85e8c0e61danielabrozzoni: re-ACKa85e8c0e61hodlinator: re-ACKa85e8c0e61Tree-SHA512: dd4b19faac923aeaa647b1c241d929609ce8242b43e3b7bc32523cc48ec92a83ac0dc5aee79f1eba8794535e0314b96cb151fd04ac973671a1ebb9b52dd16697
This commit is contained in:
@@ -2246,7 +2246,7 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
{
|
||||
int outbound_connection_count = 0;
|
||||
|
||||
if (gArgs.IsArgSet("-seednode")) {
|
||||
if (!gArgs.GetArgs("-seednode").empty()) {
|
||||
auto start = NodeClock::now();
|
||||
constexpr std::chrono::seconds SEEDNODE_TIMEOUT = 30s;
|
||||
LogPrintf("-seednode enabled. Trying the provided seeds for %d seconds before defaulting to the dnsseeds.\n", SEEDNODE_TIMEOUT.count());
|
||||
@@ -2549,7 +2549,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, Spa
|
||||
auto next_extra_network_peer{start + rng.rand_exp_duration(EXTRA_NETWORK_PEER_INTERVAL)};
|
||||
const bool dnsseed = gArgs.GetBoolArg("-dnsseed", DEFAULT_DNSSEED);
|
||||
bool add_fixed_seeds = gArgs.GetBoolArg("-fixedseeds", DEFAULT_FIXEDSEEDS);
|
||||
const bool use_seednodes{gArgs.IsArgSet("-seednode")};
|
||||
const bool use_seednodes{!gArgs.GetArgs("-seednode").empty()};
|
||||
|
||||
auto seed_node_timer = NodeClock::now();
|
||||
bool add_addr_fetch{addrman.Size() == 0 && !seed_nodes.empty()};
|
||||
|
||||
Reference in New Issue
Block a user