Expose conn_type
via a practical API for JSON-RPC consumers.
- returns the
conn_type
as an integer id for API clients. It is a simple and small change to implement and maintain, and the API can remain stable even if theConnectionType
element naming or order changes. - adds a
uint8_t
type to theConnectionType
enum class; if preferred, this can be dropped
0$ ./src/bitcoin-cli help getpeerinfo
1...
2 "inbound" : true|false, (boolean) Inbound (true) or Outbound (false)
3 "addnode" : true|false, (boolean) Whether connection was due to addnode/-connect or if it was an automatic/inbound connection
4 "conn_type" : n, (numeric) Connection type between 0 and 5:
5 0 - inbound (initiated by the peer)
6 1 - outbound-full-relay (default automatic connections)
7 2 - manual (added using the -addnode/-connect configuration options or the addnode RPC)
8 3 - feeler (short-lived automatic connection to test addresses)
9 4 - block-relay-only (does not relay transactions or addresses)
10 5 - addr-fetch (short-lived automatic connection to request addresses)