aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2023-08-22 17:50:59 -0400
committerPieter Wuille <pieter@wuille.net>2023-10-02 18:09:53 -0400
commitabf343b32026c3f8246f98c416e2c6cf5b66aa38 (patch)
treea9adcafb56ee287487780fcfcea8780e308bebaf /src
parente7b0004b375be25096fbaf3d5f6980095a90fc0c (diff)
downloadbitcoin-abf343b32026c3f8246f98c416e2c6cf5b66aa38.tar.xz
net: advertise NODE_P2P_V2 if CLI arg -v2transport is on
Co-authored-by: Dhruv Mehta <856960+dhruv@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp6
-rw-r--r--src/net.h2
-rw-r--r--src/protocol.cpp1
-rw-r--r--src/protocol.h3
-rw-r--r--src/test/util/net.h1
5 files changed, 13 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 8d954092ea..a0b4425898 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -498,6 +498,7 @@ void SetupServerArgs(ArgsManager& argsman)
argsman.AddArg("-i2psam=<ip:port>", "I2P SAM proxy to reach I2P peers and accept I2P connections (default: none)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
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);
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);
+ argsman.AddArg("-v2transport", strprintf("Support v2 transport (default: %u)", DEFAULT_V2_TRANSPORT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
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);
@@ -893,6 +894,11 @@ bool AppInitParameterInteraction(const ArgsManager& args)
}
}
+ // Signal NODE_P2P_V2 if BIP324 v2 transport is enabled.
+ if (args.GetBoolArg("-v2transport", DEFAULT_V2_TRANSPORT)) {
+ nLocalServices = ServiceFlags(nLocalServices | NODE_P2P_V2);
+ }
+
// Signal NODE_COMPACT_FILTERS if peerblockfilters and basic filters index are both enabled.
if (args.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS)) {
if (g_enabled_filter_types.count(BlockFilterType::BASIC) != 1) {
diff --git a/src/net.h b/src/net.h
index 035cca2b13..c4bd89099a 100644
--- a/src/net.h
+++ b/src/net.h
@@ -94,6 +94,8 @@ static constexpr bool DEFAULT_FIXEDSEEDS{true};
static const size_t DEFAULT_MAXRECEIVEBUFFER = 5 * 1000;
static const size_t DEFAULT_MAXSENDBUFFER = 1 * 1000;
+static constexpr bool DEFAULT_V2_TRANSPORT{false};
+
typedef int64_t NodeId;
struct AddedNodeInfo
diff --git a/src/protocol.cpp b/src/protocol.cpp
index cb956191e4..f956728af2 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -199,6 +199,7 @@ static std::string serviceFlagToStr(size_t bit)
case NODE_WITNESS: return "WITNESS";
case NODE_COMPACT_FILTERS: return "COMPACT_FILTERS";
case NODE_NETWORK_LIMITED: return "NETWORK_LIMITED";
+ case NODE_P2P_V2: return "P2P_V2";
// Not using default, so we get warned when a case is missing
}
diff --git a/src/protocol.h b/src/protocol.h
index 56668898e4..a58d671a70 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -291,6 +291,9 @@ enum ServiceFlags : uint64_t {
// See BIP159 for details on how this is implemented.
NODE_NETWORK_LIMITED = (1 << 10),
+ // NODE_P2P_V2 means the node supports BIP324 transport
+ NODE_P2P_V2 = (1 << 11),
+
// Bits 24-31 are reserved for temporary experiments. Just pick a bit that
// isn't getting used, or one not being used much, and notify the
// bitcoin-development mailing list. Remember that service bits are just
diff --git a/src/test/util/net.h b/src/test/util/net.h
index 1684da777a..0d41cf550e 100644
--- a/src/test/util/net.h
+++ b/src/test/util/net.h
@@ -65,6 +65,7 @@ constexpr ServiceFlags ALL_SERVICE_FLAGS[]{
NODE_WITNESS,
NODE_COMPACT_FILTERS,
NODE_NETWORK_LIMITED,
+ NODE_P2P_V2,
};
constexpr NetPermissionFlags ALL_NET_PERMISSION_FLAGS[]{