From 3069b56a456d98fca7c4a4ccd329581bd1f0b853 Mon Sep 17 00:00:00 2001 From: Amiti Uttarwar Date: Thu, 24 Sep 2020 22:40:46 -0700 Subject: [doc] Improve help for getpeerinfo connection_type field. --- src/rpc/net.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index def21b119e..431199d4f6 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -118,7 +118,9 @@ static RPCHelpMan getpeerinfo() {RPCResult::Type::BOOL, "inbound", "Inbound (true) or Outbound (false)"}, {RPCResult::Type::BOOL, "addnode", "Whether connection was due to addnode/-connect or if it was an automatic/inbound connection\n" "(DEPRECATED, returned only if the config option -deprecatedrpc=getpeerinfo_addnode is passed)"}, - {RPCResult::Type::STR, "connection_type", "Type of connection: \n" + Join(CONNECTION_TYPE_DOC, ",\n") + "."}, + {RPCResult::Type::STR, "connection_type", "Type of connection: \n" + Join(CONNECTION_TYPE_DOC, ",\n") + ".\n" + "Please note this output is unlikely to be stable in upcoming releases as we iterate to\n" + "best capture connection behaviors."}, {RPCResult::Type::NUM, "startingheight", "The starting height (block) of the peer"}, {RPCResult::Type::NUM, "banscore", "The ban score (DEPRECATED, returned only if config option -deprecatedrpc=banscore is passed)"}, {RPCResult::Type::NUM, "synced_headers", "The last header we have in common with this peer"}, -- cgit v1.2.3 From 41dca087b73a3627107603694f5a982ea2a53189 Mon Sep 17 00:00:00 2001 From: Amiti Uttarwar Date: Mon, 28 Sep 2020 16:58:31 -0700 Subject: [trivial] Extract connection type doc into file where it is used. This slightly reduces the size of the binary. --- src/net.h | 13 ++++--------- src/rpc/net.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/net.h b/src/net.h index 1051511f54..ee2469b8cb 100644 --- a/src/net.h +++ b/src/net.h @@ -116,17 +116,12 @@ struct CSerializedNetMsg std::string m_type; }; -const std::vector CONNECTION_TYPE_DOC{ - "outbound-full-relay (default automatic connections)", - "block-relay-only (does not relay transactions or addresses)", - "inbound (initiated by the peer)", - "manual (added via addnode RPC or -addnode/-connect configuration options)", - "addr-fetch (short-lived automatic connection for soliciting addresses)", - "feeler (short-lived automatic connection for testing addresses)"}; - /** Different types of connections to a peer. This enum encapsulates the * information we have available at the time of opening or accepting the - * connection. Aside from INBOUND, all types are initiated by us. */ + * connection. Aside from INBOUND, all types are initiated by us. + * + * If adding or removing types, please update CONNECTION_TYPE_DOC in + * src/rpc/net.cpp. */ enum class ConnectionType { /** * Inbound connections are those initiated by a peer. This is the only diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 431199d4f6..9b725b786d 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -29,6 +29,15 @@ #include +const std::vector CONNECTION_TYPE_DOC{ + "outbound-full-relay (default automatic connections)", + "block-relay-only (does not relay transactions or addresses)", + "inbound (initiated by the peer)", + "manual (added via addnode RPC or -addnode/-connect configuration options)", + "addr-fetch (short-lived automatic connection for soliciting addresses)", + "feeler (short-lived automatic connection for testing addresses)" +}; + static RPCHelpMan getconnectioncount() { return RPCHelpMan{"getconnectioncount", -- cgit v1.2.3