Skip to content

Commit 9ad7cd2

Browse files
committed
Merge #20090: [doc] Tiny followups to new getpeerinfo connection type field
41dca08 [trivial] Extract connection type doc into file where it is used. (Amiti Uttarwar) 3069b56 [doc] Improve help for getpeerinfo connection_type field. (Amiti Uttarwar) Pull request description: two commits addressing small followups from #19725 * first commit adds a clarification in the release notes that this field shouldn't be expected to be stable (suggested by sdaftuar in bitcoin/bitcoin#19725 (comment)) * second commit moves the `CONNECTION_TYPE_DOC` object out of the header file to reduce the size of the binary (suggested by MarcoFalke in bitcoin/bitcoin#19725 (comment), he tested and found a decrease of 10kB) ACKs for top commit: achow101: ACK 41dca08 laanwj: Code review ACK 41dca08 Tree-SHA512: a555df978b4341fbe05deeb40a8a655f0d3c5c1c0adcc1737fd2cf61b204a5a24a301ca0c2b5a3616554d4abf8c57074d22dbda5a50d8450bc22c57679424985
2 parents 9855422 + 41dca08 commit 9ad7cd2

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/net.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,12 @@ struct CSerializedNetMsg
115115
std::string m_type;
116116
};
117117

118-
const std::vector<std::string> CONNECTION_TYPE_DOC{
119-
"outbound-full-relay (default automatic connections)",
120-
"block-relay-only (does not relay transactions or addresses)",
121-
"inbound (initiated by the peer)",
122-
"manual (added via addnode RPC or -addnode/-connect configuration options)",
123-
"addr-fetch (short-lived automatic connection for soliciting addresses)",
124-
"feeler (short-lived automatic connection for testing addresses)"};
125-
126118
/** Different types of connections to a peer. This enum encapsulates the
127119
* information we have available at the time of opening or accepting the
128-
* connection. Aside from INBOUND, all types are initiated by us. */
120+
* connection. Aside from INBOUND, all types are initiated by us.
121+
*
122+
* If adding or removing types, please update CONNECTION_TYPE_DOC in
123+
* src/rpc/net.cpp. */
129124
enum class ConnectionType {
130125
/**
131126
* Inbound connections are those initiated by a peer. This is the only

src/rpc/net.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@
2929

3030
#include <univalue.h>
3131

32+
const std::vector<std::string> CONNECTION_TYPE_DOC{
33+
"outbound-full-relay (default automatic connections)",
34+
"block-relay-only (does not relay transactions or addresses)",
35+
"inbound (initiated by the peer)",
36+
"manual (added via addnode RPC or -addnode/-connect configuration options)",
37+
"addr-fetch (short-lived automatic connection for soliciting addresses)",
38+
"feeler (short-lived automatic connection for testing addresses)"
39+
};
40+
3241
static RPCHelpMan getconnectioncount()
3342
{
3443
return RPCHelpMan{"getconnectioncount",
@@ -119,7 +128,9 @@ static RPCHelpMan getpeerinfo()
119128
{RPCResult::Type::BOOL, "inbound", "Inbound (true) or Outbound (false)"},
120129
{RPCResult::Type::BOOL, "addnode", "Whether connection was due to addnode/-connect or if it was an automatic/inbound connection\n"
121130
"(DEPRECATED, returned only if the config option -deprecatedrpc=getpeerinfo_addnode is passed)"},
122-
{RPCResult::Type::STR, "connection_type", "Type of connection: \n" + Join(CONNECTION_TYPE_DOC, ",\n") + "."},
131+
{RPCResult::Type::STR, "connection_type", "Type of connection: \n" + Join(CONNECTION_TYPE_DOC, ",\n") + ".\n"
132+
"Please note this output is unlikely to be stable in upcoming releases as we iterate to\n"
133+
"best capture connection behaviors."},
123134
{RPCResult::Type::NUM, "startingheight", "The starting height (block) of the peer"},
124135
{RPCResult::Type::NUM, "banscore", "The ban score (DEPRECATED, returned only if config option -deprecatedrpc=banscore is passed)"},
125136
{RPCResult::Type::NUM, "synced_headers", "The last header we have in common with this peer"},

0 commit comments

Comments
 (0)