mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge #19725: [RPC] Add connection type to getpeerinfo, improve logs
a512925e19[doc] Release notes (Amiti Uttarwar)50f94b34a3[rpc] Deprecate getpeerinfo addnode field (Amiti Uttarwar)df091b9b50[refactor] Rename test file to allow any getpeerinfo deprecations. (Amiti Uttarwar)395acfa83a[rpc] Add connection type to getpeerinfo RPC, update tests (Amiti Uttarwar)49c10a9ca4[log] Add connection type to log statement (Amiti Uttarwar) Pull request description: After #19316, we can more directly expose information about the connection type on the `getpeerinfo` RPC. Doing so also makes the existing addnode field redundant, so this PR begins the process of deprecating this field. This PR also includes one commit that improves a log message, as both use a shared function to return the connection type as a string. Suggested by sdaftuar- https://github.com/bitcoin/bitcoin/pull/19316#discussion_r468001604 & https://github.com/bitcoin/bitcoin/pull/19316#discussion_r468018093 ACKs for top commit: jnewbery: Code review ACKa512925e19. sipa: utACKa512925e19guggero: Tested and code review ACKa512925e. MarcoFalke: cr ACKa512925e19🌇 promag: Code review ACKa512925e19. Tree-SHA512: 601a7a38aee235ee59aca690784f886dc2ae4e418b2e6422c4b58cd597376c00f74910f66920b08a08a0bec28bf8022e71a1435785ff6ba8a188954261aba78e
This commit is contained in:
11
src/net.h
11
src/net.h
@@ -114,6 +114,14 @@ struct CSerializedNetMsg
|
||||
std::string m_type;
|
||||
};
|
||||
|
||||
const std::vector<std::string> 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. */
|
||||
@@ -691,6 +699,7 @@ public:
|
||||
// Bind address of our side of the connection
|
||||
CAddress addrBind;
|
||||
uint32_t m_mapped_as;
|
||||
std::string m_conn_type_string;
|
||||
};
|
||||
|
||||
|
||||
@@ -1144,6 +1153,8 @@ public:
|
||||
std::string GetAddrName() const;
|
||||
//! Sets the addrName only if it was not previously set
|
||||
void MaybeSetAddrName(const std::string& addrNameIn);
|
||||
|
||||
std::string ConnectionTypeAsString() const;
|
||||
};
|
||||
|
||||
/** Return a timestamp in the future (in microseconds) for exponentially distributed events. */
|
||||
|
||||
Reference in New Issue
Block a user