Skip to content

Commit 6f882e6

Browse files
committed
Merge bitcoin#28331: BIP324 integration
75a3291 doc: mention BIP324 support in bips.md (Pieter Wuille) 64ca721 test: enable v2 transport between nodes in some functional tests (Pieter Wuille) 05d19fb test: Functional test for opportunistic encryption (dhruv) b815cce net: expose transport types/session IDs of connections in RPC and logs (Pieter Wuille) 432a62c net: reconnect with V1Transport under certain conditions (Pieter Wuille) 4d265d0 sync: modernize CSemaphore / CSemaphoreGrant (Pieter Wuille) c73cd42 rpc: addnode arg to use BIP324 v2 p2p (dhruv) 62d21ee net: use V2Transport when NODE_P2P_V2 service flag is present (Pieter Wuille) a4706bc rpc: don't report v2 handshake bytes in the per-type sent byte statistics (Sebastian Falbesoner) abf343b net: advertise NODE_P2P_V2 if CLI arg -v2transport is on (Pieter Wuille) Pull request description: Part of bitcoin#27634. This makes BIP324 support feature complete, through a (default off) `-v2transport` option for enabling V2 connections. If it is enabled: * The `NODE_P2P_V2` service flag (*1 << 11*) is advertized. * Inbound connections can use V1 or V2 (automatically detected based on the protocol used by the peer) * V2 connections are used on outbound when the `NODE_P2P_V2` service is available (or the new `use_v2` parameter is set on the `addnode` RPC). * V2 outbound connections that instantly fail get retried as V1. There are two new RPC fields, `"transport_protocol_type"` and `"session_id"`, in `getpeerinfo`. ACKs for top commit: mzumsande: re-ACK 75a3291 theStack: re-ACK 75a3291 Tree-SHA512: 90ea1cd37f3dce410a59ff5de1c2405891e8aa62318d0e06dcb68b21603fb0c061631526633f3d4fb630e63d2b8db407eed48e246befcbef3503bea893a4ff15
2 parents e7b0004 + 75a3291 commit 6f882e6

22 files changed

+540
-83
lines changed

doc/bips.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ BIPs that are implemented by Bitcoin Core:
4949
* [`BIP 173`](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki): Bech32 addresses for native Segregated Witness outputs are supported as of **v0.16.0** ([PR 11167](https://github.com/bitcoin/bitcoin/pull/11167)). Bech32 addresses are generated by default as of **v0.20.0** ([PR 16884](https://github.com/bitcoin/bitcoin/pull/16884)).
5050
* [`BIP 174`](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki): RPCs to operate on Partially Signed Bitcoin Transactions (PSBT) are present as of **v0.17.0** ([PR 13557](https://github.com/bitcoin/bitcoin/pull/13557)).
5151
* [`BIP 176`](https://github.com/bitcoin/bips/blob/master/bip-0176.mediawiki): Bits Denomination [QT only] is supported as of **v0.16.0** ([PR 12035](https://github.com/bitcoin/bitcoin/pull/12035)).
52+
* [`BIP 324`](https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki): The v2 transport protocol specified by BIP324 and the associated `NODE_P2P_V2` service bit are supported as of **v26.0**, but off by default ([PR 28331](https://github.com/bitcoin/bitcoin/pull/28331)).
5253
* [`BIP 325`](https://github.com/bitcoin/bips/blob/master/bip-0325.mediawiki): Signet test network is supported as of **v0.21.0** ([PR 18267](https://github.com/bitcoin/bitcoin/pull/18267)).
5354
* [`BIP 339`](https://github.com/bitcoin/bips/blob/master/bip-0339.mediawiki): Relay of transactions by wtxid is supported as of **v0.21.0** ([PR 18044](https://github.com/bitcoin/bitcoin/pull/18044)).
5455
* [`BIP 340`](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki)

src/init.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ void SetupServerArgs(ArgsManager& argsman)
498498
argsman.AddArg("-i2psam=<ip:port>", "I2P SAM proxy to reach I2P peers and accept I2P connections (default: none)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
499499
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);
500500
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);
501+
argsman.AddArg("-v2transport", strprintf("Support v2 transport (default: %u)", DEFAULT_V2_TRANSPORT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
501502
argsman.AddArg("-peerbloomfilters", strprintf("Support filtering of blocks and transaction with bloom filters (default: %u)", DEFAULT_PEERBLOOMFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
502503
argsman.AddArg("-peerblockfilters", strprintf("Serve compact block filters to peers per BIP 157 (default: %u)", DEFAULT_PEERBLOCKFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
503504
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)
893894
}
894895
}
895896

897+
// Signal NODE_P2P_V2 if BIP324 v2 transport is enabled.
898+
if (args.GetBoolArg("-v2transport", DEFAULT_V2_TRANSPORT)) {
899+
nLocalServices = ServiceFlags(nLocalServices | NODE_P2P_V2);
900+
}
901+
896902
// Signal NODE_COMPACT_FILTERS if peerblockfilters and basic filters index are both enabled.
897903
if (args.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS)) {
898904
if (g_enabled_filter_types.count(BlockFilterType::BASIC) != 1) {

src/net.cpp

Lines changed: 163 additions & 32 deletions
Large diffs are not rendered by default.

src/net.h

Lines changed: 78 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,17 @@ static constexpr bool DEFAULT_FIXEDSEEDS{true};
9494
static const size_t DEFAULT_MAXRECEIVEBUFFER = 5 * 1000;
9595
static const size_t DEFAULT_MAXSENDBUFFER = 1 * 1000;
9696

97+
static constexpr bool DEFAULT_V2_TRANSPORT{false};
98+
9799
typedef int64_t NodeId;
98100

99-
struct AddedNodeInfo
100-
{
101-
std::string strAddedNode;
101+
struct AddedNodeParams {
102+
std::string m_added_node;
103+
bool m_use_v2transport;
104+
};
105+
106+
struct AddedNodeInfo {
107+
AddedNodeParams m_params;
102108
CService resolvedAddress;
103109
bool fConnected;
104110
bool fInbound;
@@ -226,6 +232,10 @@ class CNodeStats
226232
Network m_network;
227233
uint32_t m_mapped_as;
228234
ConnectionType m_conn_type;
235+
/** Transport protocol type. */
236+
TransportProtocolType m_transport_type;
237+
/** BIP324 session id string in hex, if any. */
238+
std::string m_session_id;
229239
};
230240

231241

@@ -262,6 +272,15 @@ class Transport {
262272
public:
263273
virtual ~Transport() {}
264274

275+
struct Info
276+
{
277+
TransportProtocolType transport_type;
278+
std::optional<uint256> session_id;
279+
};
280+
281+
/** Retrieve information about this transport. */
282+
virtual Info GetInfo() const noexcept = 0;
283+
265284
// 1. Receiver side functions, for decoding bytes received on the wire into transport protocol
266285
// agnostic CNetMessage (message type & payload) objects.
267286

@@ -355,6 +374,11 @@ class Transport {
355374

356375
/** Return the memory usage of this transport attributable to buffered data to send. */
357376
virtual size_t GetSendMemoryUsage() const noexcept = 0;
377+
378+
// 3. Miscellaneous functions.
379+
380+
/** Whether upon disconnections, a reconnect with V1 is warranted. */
381+
virtual bool ShouldReconnectV1() const noexcept = 0;
358382
};
359383

360384
class V1Transport final : public Transport
@@ -415,6 +439,8 @@ class V1Transport final : public Transport
415439
return WITH_LOCK(m_recv_mutex, return CompleteInternal());
416440
}
417441

442+
Info GetInfo() const noexcept override;
443+
418444
bool ReceivedBytes(Span<const uint8_t>& msg_bytes) override EXCLUSIVE_LOCKS_REQUIRED(!m_recv_mutex)
419445
{
420446
AssertLockNotHeld(m_recv_mutex);
@@ -434,6 +460,7 @@ class V1Transport final : public Transport
434460
BytesToSend GetBytesToSend(bool have_next_message) const noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_send_mutex);
435461
void MarkBytesSent(size_t bytes_sent) noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_send_mutex);
436462
size_t GetSendMemoryUsage() const noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_send_mutex);
463+
bool ShouldReconnectV1() const noexcept override { return false; }
437464
};
438465

439466
class V2Transport final : public Transport
@@ -602,6 +629,8 @@ class V2Transport final : public Transport
602629
std::string m_send_type GUARDED_BY(m_send_mutex);
603630
/** Current sender state. */
604631
SendState m_send_state GUARDED_BY(m_send_mutex);
632+
/** Whether we've sent at least 24 bytes (which would trigger disconnect for V1 peers). */
633+
bool m_sent_v1_header_worth GUARDED_BY(m_send_mutex) {false};
605634

606635
/** Change the receive state. */
607636
void SetReceiveState(RecvState recv_state) noexcept EXCLUSIVE_LOCKS_REQUIRED(m_recv_mutex);
@@ -647,6 +676,10 @@ class V2Transport final : public Transport
647676
BytesToSend GetBytesToSend(bool have_next_message) const noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_send_mutex);
648677
void MarkBytesSent(size_t bytes_sent) noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_send_mutex);
649678
size_t GetSendMemoryUsage() const noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_send_mutex);
679+
680+
// Miscellaneous functions.
681+
bool ShouldReconnectV1() const noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_recv_mutex, !m_send_mutex);
682+
Info GetInfo() const noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_recv_mutex);
650683
};
651684

652685
struct CNodeOptions
@@ -655,6 +688,7 @@ struct CNodeOptions
655688
std::unique_ptr<i2p::sam::Session> i2p_sam_session = nullptr;
656689
bool prefer_evict = false;
657690
size_t recv_flood_size{DEFAULT_MAXRECEIVEBUFFER * 1000};
691+
bool use_v2transport = false;
658692
};
659693

660694
/** Information about a peer */
@@ -699,6 +733,8 @@ class CNode
699733
// Bind address of our side of the connection
700734
const CAddress addrBind;
701735
const std::string m_addr_name;
736+
/** The pszDest argument provided to ConnectNode(). Only used for reconnections. */
737+
const std::string m_dest;
702738
//! Whether this peer is an inbound onion, i.e. connected via our Tor onion service.
703739
const bool m_inbound_onion;
704740
std::atomic<int> nVersion{0};
@@ -1072,7 +1108,11 @@ class CConnman
10721108
vWhitelistedRange = connOptions.vWhitelistedRange;
10731109
{
10741110
LOCK(m_added_nodes_mutex);
1075-
m_added_nodes = connOptions.m_added_nodes;
1111+
1112+
for (const std::string& added_node : connOptions.m_added_nodes) {
1113+
// -addnode cli arg does not currently have a way to signal BIP324 support
1114+
m_added_node_params.push_back({added_node, false});
1115+
}
10761116
}
10771117
m_onion_binds = connOptions.onion_binds;
10781118
}
@@ -1096,7 +1136,7 @@ class CConnman
10961136
bool GetNetworkActive() const { return fNetworkActive; };
10971137
bool GetUseAddrmanOutgoing() const { return m_use_addrman_outgoing; };
10981138
void SetNetworkActive(bool active);
1099-
void OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant* grantOutbound, const char* strDest, ConnectionType conn_type) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex);
1139+
void OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant&& grant_outbound, const char* strDest, ConnectionType conn_type, bool use_v2transport) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex);
11001140
bool CheckIncomingNonce(uint64_t nonce);
11011141

11021142
// alias for thread safety annotations only, not defined
@@ -1159,7 +1199,7 @@ class CConnman
11591199
// Count the number of block-relay-only peers we have over our limit.
11601200
int GetExtraBlockRelayCount() const;
11611201

1162-
bool AddNode(const std::string& node) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex);
1202+
bool AddNode(const AddedNodeParams& add) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex);
11631203
bool RemoveAddedNode(const std::string& node) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex);
11641204
std::vector<AddedNodeInfo> GetAddedNodeInfo() const EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex);
11651205

@@ -1242,10 +1282,10 @@ class CConnman
12421282
bool Bind(const CService& addr, unsigned int flags, NetPermissionFlags permissions);
12431283
bool InitBinds(const Options& options);
12441284

1245-
void ThreadOpenAddedConnections() EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex, !m_unused_i2p_sessions_mutex);
1285+
void ThreadOpenAddedConnections() EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex, !m_unused_i2p_sessions_mutex, !m_reconnections_mutex);
12461286
void AddAddrFetch(const std::string& strDest) EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex);
12471287
void ProcessAddrFetch() EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex, !m_unused_i2p_sessions_mutex);
1248-
void ThreadOpenConnections(std::vector<std::string> connect) EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex, !m_added_nodes_mutex, !m_nodes_mutex, !m_unused_i2p_sessions_mutex);
1288+
void ThreadOpenConnections(std::vector<std::string> connect) EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex, !m_added_nodes_mutex, !m_nodes_mutex, !m_unused_i2p_sessions_mutex, !m_reconnections_mutex);
12491289
void ThreadMessageHandler() EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc);
12501290
void ThreadI2PAcceptIncoming();
12511291
void AcceptConnection(const ListenSocket& hListenSocket);
@@ -1263,7 +1303,7 @@ class CConnman
12631303
const CAddress& addr_bind,
12641304
const CAddress& addr);
12651305

1266-
void DisconnectNodes();
1306+
void DisconnectNodes() EXCLUSIVE_LOCKS_REQUIRED(!m_reconnections_mutex, !m_nodes_mutex);
12671307
void NotifyNumConnectionsChanged();
12681308
/** Return true if the peer is inactive and should be disconnected. */
12691309
bool InactivityCheck(const CNode& node) const;
@@ -1295,7 +1335,7 @@ class CConnman
12951335
*/
12961336
void SocketHandlerListening(const Sock::EventsPerSock& events_per_sock);
12971337

1298-
void ThreadSocketHandler() EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex, !mutexMsgProc);
1338+
void ThreadSocketHandler() EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex, !mutexMsgProc, !m_nodes_mutex, !m_reconnections_mutex);
12991339
void ThreadDNSAddressSeed() EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex, !m_nodes_mutex);
13001340

13011341
uint64_t CalculateKeyedNetGroup(const CAddress& ad) const;
@@ -1312,7 +1352,7 @@ class CConnman
13121352
bool AlreadyConnectedToAddress(const CAddress& addr);
13131353

13141354
bool AttemptToEvictConnection();
1315-
CNode* ConnectNode(CAddress addrConnect, const char *pszDest, bool fCountFailure, ConnectionType conn_type) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex);
1355+
CNode* ConnectNode(CAddress addrConnect, const char *pszDest, bool fCountFailure, ConnectionType conn_type, bool use_v2transport) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex);
13161356
void AddWhitelistPermissionFlags(NetPermissionFlags& flags, const CNetAddr &addr) const;
13171357

13181358
void DeleteNode(CNode* pnode);
@@ -1384,7 +1424,10 @@ class CConnman
13841424
const NetGroupManager& m_netgroupman;
13851425
std::deque<std::string> m_addr_fetches GUARDED_BY(m_addr_fetches_mutex);
13861426
Mutex m_addr_fetches_mutex;
1387-
std::vector<std::string> m_added_nodes GUARDED_BY(m_added_nodes_mutex);
1427+
1428+
// connection string and whether to use v2 p2p
1429+
std::vector<AddedNodeParams> m_added_node_params GUARDED_BY(m_added_nodes_mutex);
1430+
13881431
mutable Mutex m_added_nodes_mutex;
13891432
std::vector<CNode*> m_nodes GUARDED_BY(m_nodes_mutex);
13901433
std::list<CNode*> m_nodes_disconnected;
@@ -1523,6 +1566,29 @@ class CConnman
15231566
*/
15241567
std::queue<std::unique_ptr<i2p::sam::Session>> m_unused_i2p_sessions GUARDED_BY(m_unused_i2p_sessions_mutex);
15251568

1569+
/**
1570+
* Mutex protecting m_reconnections.
1571+
*/
1572+
Mutex m_reconnections_mutex;
1573+
1574+
/** Struct for entries in m_reconnections. */
1575+
struct ReconnectionInfo
1576+
{
1577+
CAddress addr_connect;
1578+
CSemaphoreGrant grant;
1579+
std::string destination;
1580+
ConnectionType conn_type;
1581+
bool use_v2transport;
1582+
};
1583+
1584+
/**
1585+
* List of reconnections we have to make.
1586+
*/
1587+
std::list<ReconnectionInfo> m_reconnections GUARDED_BY(m_reconnections_mutex);
1588+
1589+
/** Attempt reconnections, if m_reconnections non-empty. */
1590+
void PerformReconnections() EXCLUSIVE_LOCKS_REQUIRED(!m_reconnections_mutex, !m_unused_i2p_sessions_mutex);
1591+
15261592
/**
15271593
* Cap on the size of `m_unused_i2p_sessions`, to ensure it does not
15281594
* unexpectedly use too much memory.

src/net_processing.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3585,13 +3585,16 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
35853585
return;
35863586
}
35873587

3588-
if (!pfrom.IsInboundConn()) {
3588+
// Log succesful connections unconditionally for outbound, but not for inbound as those
3589+
// can be triggered by an attacker at high rate.
3590+
if (!pfrom.IsInboundConn() || LogAcceptCategory(BCLog::NET, BCLog::Level::Debug)) {
35893591
const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)};
3590-
LogPrintf("New outbound peer connected: version: %d, blocks=%d, peer=%d%s%s (%s)\n",
3592+
LogPrintf("New %s %s peer connected: version: %d, blocks=%d, peer=%d%s%s\n",
3593+
pfrom.ConnectionTypeAsString(),
3594+
TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
35913595
pfrom.nVersion.load(), peer->m_starting_height,
35923596
pfrom.GetId(), (fLogIPs ? strprintf(", peeraddr=%s", pfrom.addr.ToStringAddrPort()) : ""),
3593-
(mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""),
3594-
pfrom.ConnectionTypeAsString());
3597+
(mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
35953598
}
35963599

35973600
if (pfrom.GetCommonVersion() >= SHORT_IDS_BLOCKS_VERSION) {

src/node/connection_types.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,17 @@ std::string ConnectionTypeAsString(ConnectionType conn_type)
2424

2525
assert(false);
2626
}
27+
28+
std::string TransportTypeAsString(TransportProtocolType transport_type)
29+
{
30+
switch (transport_type) {
31+
case TransportProtocolType::DETECTING:
32+
return "detecting";
33+
case TransportProtocolType::V1:
34+
return "v1";
35+
case TransportProtocolType::V2:
36+
return "v2";
37+
} // no default case, so the compiler can warn about missing cases
38+
39+
assert(false);
40+
}

src/node/connection_types.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define BITCOIN_NODE_CONNECTION_TYPES_H
77

88
#include <string>
9+
#include <stdint.h>
910

1011
/** Different types of connections to a peer. This enum encapsulates the
1112
* information we have available at the time of opening or accepting the
@@ -79,4 +80,14 @@ enum class ConnectionType {
7980
/** Convert ConnectionType enum to a string value */
8081
std::string ConnectionTypeAsString(ConnectionType conn_type);
8182

83+
/** Transport layer version */
84+
enum class TransportProtocolType : uint8_t {
85+
DETECTING, //!< Peer could be v1 or v2
86+
V1, //!< Unencrypted, plaintext protocol
87+
V2, //!< BIP324 protocol
88+
};
89+
90+
/** Convert TransportProtocolType enum to a string value */
91+
std::string TransportTypeAsString(TransportProtocolType transport_type);
92+
8293
#endif // BITCOIN_NODE_CONNECTION_TYPES_H

src/protocol.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ static std::string serviceFlagToStr(size_t bit)
199199
case NODE_WITNESS: return "WITNESS";
200200
case NODE_COMPACT_FILTERS: return "COMPACT_FILTERS";
201201
case NODE_NETWORK_LIMITED: return "NETWORK_LIMITED";
202+
case NODE_P2P_V2: return "P2P_V2";
202203
// Not using default, so we get warned when a case is missing
203204
}
204205

src/protocol.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ enum ServiceFlags : uint64_t {
291291
// See BIP159 for details on how this is implemented.
292292
NODE_NETWORK_LIMITED = (1 << 10),
293293

294+
// NODE_P2P_V2 means the node supports BIP324 transport
295+
NODE_P2P_V2 = (1 << 11),
296+
294297
// Bits 24-31 are reserved for temporary experiments. Just pick a bit that
295298
// isn't getting used, or one not being used much, and notify the
296299
// bitcoin-development mailing list. Remember that service bits are just

src/rpc/client.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
301301
{ "addpeeraddress", 2, "tried"},
302302
{ "sendmsgtopeer", 0, "peer_id" },
303303
{ "stop", 0, "wait" },
304+
{ "addnode", 2, "v2transport" },
304305
};
305306
// clang-format on
306307

0 commit comments

Comments
 (0)