diff options
author | Ava Chow <github@achow101.com> | 2024-12-17 13:06:08 -0500 |
---|---|---|
committer | Ava Chow <github@achow101.com> | 2024-12-17 13:06:08 -0500 |
commit | 6db725662d9edff275abfac6ef3827ebec882f66 (patch) | |
tree | bee7b09350bfb9c77079e0a2e449093ef00eb944 /src | |
parent | d6b225f1652526cb053ec32c8ff09160d5a759c5 (diff) | |
parent | 5576618152aff0358aeb1c5189422882b419de2d (diff) |
Merge bitcoin/bitcoin#31469: [28.x] 28.1rc2 backportsv28.1rc2
5576618152aff0358aeb1c5189422882b419de2d doc: update release notes for 28.1rc2 (Ava Chow)
01fe07a2cea07b6e72a33a5d230ec16118b9a26b examples: Generate example bitcoin.conf (Ava Chow)
7ddfcf32da7a0bfb40bc3b4f5d28ac078fd1c5d7 doc: Generate manpages (Ava Chow)
e0b27b234cb31f53ddd51a923d8f5d0a30f92375 build: Bump to 28.1rc2 (Ava Chow)
bdc6b3e531a107c52d73f72ddf788114381e241c Add release note for #31223 (Martin Zumsande)
a0585b6087ac2f3e54efa50795cba83caeac5ab0 test: add functional test for -port behavior (Martin Zumsande)
bbde830b97000b8bbfbaefc54504f659a34f651c net, init: derive default onion port if a user specified a -port (Martin Zumsande)
227642d5afeb9918269192500d1a41bcb64b51c5 test: fix MIN macro-redefinition (0xb10c)
b8112cf4226265a5b43e2b556ce9fa97caf3c28a util: use explicit cast in MultiIntBitSet::Fill() (Vasil Dimov)
2835158be0410fe82a56752d9ffe60e2a77dc0cd fuzz: add cstdlib to FuzzedDataProvider (fanquake)
Pull request description:
Backports:
* #31223
* #31448
* #31431
* #31419
ACKs for top commit:
hodlinator:
re-ACK 5576618152aff0358aeb1c5189422882b419de2d
Tree-SHA512: f99f3c5960f18f6894832c5f9a827f97fd3c6e086670341760ce1b77c304d53136492371c59148f3b4bbcfe2d5428c835fe632c61b229b40f1f6f6cf2b72cdca
Diffstat (limited to 'src')
-rw-r--r-- | src/chainparamsbase.cpp | 10 | ||||
-rw-r--r-- | src/chainparamsbase.h | 6 | ||||
-rw-r--r-- | src/init.cpp | 10 | ||||
-rw-r--r-- | src/test/fuzz/FuzzedDataProvider.h | 1 | ||||
-rw-r--r-- | src/torcontrol.cpp | 4 | ||||
-rw-r--r-- | src/torcontrol.h | 2 | ||||
-rw-r--r-- | src/util/bitset.h | 2 |
7 files changed, 18 insertions, 17 deletions
diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index aadd04e509..060d519d92 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -41,15 +41,15 @@ std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const ChainType chain) { switch (chain) { case ChainType::MAIN: - return std::make_unique<CBaseChainParams>("", 8332, 8334); + return std::make_unique<CBaseChainParams>("", 8332); case ChainType::TESTNET: - return std::make_unique<CBaseChainParams>("testnet3", 18332, 18334); + return std::make_unique<CBaseChainParams>("testnet3", 18332); case ChainType::TESTNET4: - return std::make_unique<CBaseChainParams>("testnet4", 48332, 48334); + return std::make_unique<CBaseChainParams>("testnet4", 48332); case ChainType::SIGNET: - return std::make_unique<CBaseChainParams>("signet", 38332, 38334); + return std::make_unique<CBaseChainParams>("signet", 38332); case ChainType::REGTEST: - return std::make_unique<CBaseChainParams>("regtest", 18443, 18445); + return std::make_unique<CBaseChainParams>("regtest", 18443); } assert(false); } diff --git a/src/chainparamsbase.h b/src/chainparamsbase.h index c75a70cb96..adbd6a5174 100644 --- a/src/chainparamsbase.h +++ b/src/chainparamsbase.h @@ -22,15 +22,13 @@ class CBaseChainParams public: const std::string& DataDir() const { return strDataDir; } uint16_t RPCPort() const { return m_rpc_port; } - uint16_t OnionServiceTargetPort() const { return m_onion_service_target_port; } CBaseChainParams() = delete; - CBaseChainParams(const std::string& data_dir, uint16_t rpc_port, uint16_t onion_service_target_port) - : m_rpc_port(rpc_port), m_onion_service_target_port(onion_service_target_port), strDataDir(data_dir) {} + CBaseChainParams(const std::string& data_dir, uint16_t rpc_port) + : m_rpc_port(rpc_port), strDataDir(data_dir) {} private: const uint16_t m_rpc_port; - const uint16_t m_onion_service_target_port; std::string strDataDir; }; diff --git a/src/init.cpp b/src/init.cpp index 2572f9d78c..541b75ce95 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -524,7 +524,7 @@ void SetupServerArgs(ArgsManager& argsman) argsman.AddArg("-addnode=<ip>", strprintf("Add a node to connect to and attempt to keep the connection open (see the addnode RPC help for more info). This option can be specified multiple times to add multiple nodes; connections are limited to %u at a time and are counted separately from the -maxconnections limit.", MAX_ADDNODE_CONNECTIONS), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION); argsman.AddArg("-asmap=<file>", strprintf("Specify asn mapping used for bucketing of the peers (default: %s). Relative paths will be prefixed by the net-specific datadir location.", DEFAULT_ASMAP_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); argsman.AddArg("-bantime=<n>", strprintf("Default duration (in seconds) of manually configured bans (default: %u)", DEFAULT_MISBEHAVING_BANTIME), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); - argsman.AddArg("-bind=<addr>[:<port>][=onion]", strprintf("Bind to given address and always listen on it (default: 0.0.0.0). Use [host]:port notation for IPv6. Append =onion to tag any incoming connections to that address and port as incoming Tor connections (default: 127.0.0.1:%u=onion, testnet3: 127.0.0.1:%u=onion, testnet4: 127.0.0.1:%u=onion, signet: 127.0.0.1:%u=onion, regtest: 127.0.0.1:%u=onion)", defaultBaseParams->OnionServiceTargetPort(), testnetBaseParams->OnionServiceTargetPort(), testnet4BaseParams->OnionServiceTargetPort(), signetBaseParams->OnionServiceTargetPort(), regtestBaseParams->OnionServiceTargetPort()), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION); + argsman.AddArg("-bind=<addr>[:<port>][=onion]", strprintf("Bind to given address and always listen on it (default: 0.0.0.0). Use [host]:port notation for IPv6. Append =onion to tag any incoming connections to that address and port as incoming Tor connections (default: 127.0.0.1:%u=onion, testnet3: 127.0.0.1:%u=onion, testnet4: 127.0.0.1:%u=onion, signet: 127.0.0.1:%u=onion, regtest: 127.0.0.1:%u=onion)", defaultChainParams->GetDefaultPort() + 1, testnetChainParams->GetDefaultPort() + 1, testnet4ChainParams->GetDefaultPort() + 1, signetChainParams->GetDefaultPort() + 1, regtestChainParams->GetDefaultPort() + 1), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION); argsman.AddArg("-cjdnsreachable", "If set, then this host is configured for CJDNS (connecting to fc00::/8 addresses would lead us to the CJDNS network, see doc/cjdns.md) (default: 0)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); 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); @@ -551,7 +551,7 @@ void SetupServerArgs(ArgsManager& argsman) argsman.AddArg("-peerbloomfilters", strprintf("Support filtering of blocks and transaction with bloom filters (default: %u)", DEFAULT_PEERBLOOMFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); argsman.AddArg("-peerblockfilters", strprintf("Serve compact block filters to peers per BIP 157 (default: %u)", DEFAULT_PEERBLOCKFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); argsman.AddArg("-txreconciliation", strprintf("Enable transaction reconciliations per BIP 330 (default: %d)", DEFAULT_TXRECONCILIATION_ENABLE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION); - argsman.AddArg("-port=<port>", strprintf("Listen for connections on <port> (default: %u, testnet3: %u, testnet4: %u, signet: %u, regtest: %u). Not relevant for I2P (see doc/i2p.md).", defaultChainParams->GetDefaultPort(), testnetChainParams->GetDefaultPort(), testnet4ChainParams->GetDefaultPort(), signetChainParams->GetDefaultPort(), regtestChainParams->GetDefaultPort()), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION); + argsman.AddArg("-port=<port>", strprintf("Listen for connections on <port> (default: %u, testnet3: %u, testnet4: %u, signet: %u, regtest: %u). Not relevant for I2P (see doc/i2p.md). If set to a value x, the default onion listening port will be set to x+1.", defaultChainParams->GetDefaultPort(), testnetChainParams->GetDefaultPort(), testnet4ChainParams->GetDefaultPort(), signetChainParams->GetDefaultPort(), regtestChainParams->GetDefaultPort()), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION); #ifdef HAVE_SOCKADDR_UN argsman.AddArg("-proxy=<ip:port|path>", "Connect through SOCKS5 proxy, set -noproxy to disable (default: disabled). May be a local file path prefixed with 'unix:' if the proxy supports it.", ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_ELISION, OptionsCategory::CONNECTION); #else @@ -1852,6 +1852,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) const uint16_t default_bind_port = static_cast<uint16_t>(args.GetIntArg("-port", Params().GetDefaultPort())); + const uint16_t default_bind_port_onion = default_bind_port + 1; + const auto BadPortWarning = [](const char* prefix, uint16_t port) { return strprintf(_("%s request to listen on port %u. This port is considered \"bad\" and " "thus it is unlikely that any peer will connect to it. See " @@ -1876,7 +1878,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) const std::string network_type = bind_arg.substr(index + 1); if (network_type == "onion") { const std::string truncated_bind_arg = bind_arg.substr(0, index); - bind_addr = Lookup(truncated_bind_arg, BaseParams().OnionServiceTargetPort(), false); + bind_addr = Lookup(truncated_bind_arg, default_bind_port_onion, false); if (bind_addr.has_value()) { connOptions.onion_binds.push_back(bind_addr.value()); continue; @@ -1912,7 +1914,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) } else if (!connOptions.vBinds.empty()) { onion_service_target = connOptions.vBinds.front(); } else { - onion_service_target = DefaultOnionServiceTarget(); + onion_service_target = DefaultOnionServiceTarget(default_bind_port_onion); connOptions.onion_binds.push_back(onion_service_target); } diff --git a/src/test/fuzz/FuzzedDataProvider.h b/src/test/fuzz/FuzzedDataProvider.h index 5903ed8379..e57b95b630 100644 --- a/src/test/fuzz/FuzzedDataProvider.h +++ b/src/test/fuzz/FuzzedDataProvider.h @@ -18,6 +18,7 @@ #include <climits> #include <cstddef> #include <cstdint> +#include <cstdlib> #include <cstring> #include <initializer_list> #include <limits> diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index 4f79644c8d..42ba51e9c0 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -711,9 +711,9 @@ void StopTorControl() } } -CService DefaultOnionServiceTarget() +CService DefaultOnionServiceTarget(uint16_t port) { struct in_addr onion_service_target; onion_service_target.s_addr = htonl(INADDR_LOOPBACK); - return {onion_service_target, BaseParams().OnionServiceTargetPort()}; + return {onion_service_target, port}; } diff --git a/src/torcontrol.h b/src/torcontrol.h index 4a0eef223e..0b66201cf1 100644 --- a/src/torcontrol.h +++ b/src/torcontrol.h @@ -27,7 +27,7 @@ void StartTorControl(CService onion_service_target); void InterruptTorControl(); void StopTorControl(); -CService DefaultOnionServiceTarget(); +CService DefaultOnionServiceTarget(uint16_t port); /** Reply from Tor, can be single or multi-line */ class TorControlReply diff --git a/src/util/bitset.h b/src/util/bitset.h index 6f9e808c37..17ebc709eb 100644 --- a/src/util/bitset.h +++ b/src/util/bitset.h @@ -366,7 +366,7 @@ public: if (count) { unsigned i = 0; while (count > LIMB_BITS) { - ret.m_val[i++] = ~I{0}; + ret.m_val[i++] = I(~I{0}); count -= LIMB_BITS; } ret.m_val[i] = I(~I{0}) >> (LIMB_BITS - count); |