Repository navigation
add: getnetworkinfo RPC support - #319
Conversation
8a0bb84 to
bb8e789
Compare
|
Rebased to resolve conflicts against |
|
ey @0xB10C, I can help resolve the merge conflicts if you'd like. Just let me know and I'll take care of it. |
|
Feel free to rebase now. I think current |
| use corepc_node::vtype::{ | ||
| GetNetworkInfo as RPCGetNetworkInfo, GetNetworkInfoAddress as RPCGetNetworkInfoAddress, | ||
| GetNetworkInfoNetwork as RPCGetNetworkInfoNetwork, | ||
| }; |
There was a problem hiding this comment.
Should we be using corepc_client here?
e.g.
use corepc_client::types::v28::{
GetNetworkInfo as RPCGetNetworkInfo,
GetNetworkInfoAddress as RPCGetNetworkInfoAddress,
GetNetworkInfoNetwork as RPCGetNetworkInfoNetwork,
};Note that corepc-node is actually "Utility to run a regtest bitcoind process, useful in integration testing environments", see: https://github.com/rust-bitcoin/corepc/blob/master/node/Cargo.toml
I think that v28 is the correct version but please verify this @GuiSchet!
There was a problem hiding this comment.
right, it should be e.g. corepc_types::model::GetNetworkInfo (and not the version specific corepc_client::types::v28::GetNetworkInfo)
2cd5da7 to
005c44b
Compare
|
I went ahead and rebased this to start reviewing it! |
| required double relay_fee = 13; // Minimum relay fee for transactions in BTC/kB | ||
| required double incremental_fee = 14; // Minimum fee rate increment for mempool limiting in BTC/kB | ||
| repeated NetworkInfoLocalAddress local_addresses = 15; // List of local addresses | ||
| required string warnings = 16; // Any network and blockchain warnings |
There was a problem hiding this comment.
warnings is a list of strings
"warnings" : [ (json array) any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)
"str", (string) warning
...
]
| relay_fee: info.relay_fee, | ||
| incremental_fee: info.incremental_fee, | ||
| local_addresses: info.local_addresses.into_iter().map(|a| a.into()).collect(), | ||
| warnings: info.warnings.join("; "), |
There was a problem hiding this comment.
probably best to leave it as a list of warnings!
|
Fixed both review observations: 1. Import correction
2. Warnings field as array
|
9af6317 to
f4aab7c
Compare
|
I fixed up some minor details. This looks good now. Thank you again @GuiSchet! |
Implementation of
getnetworkinfoRPC ExtractorThis PR adds support for Bitcoin Core's
getnetworkinfoRPC call to the rpc-extractor, following patterns established in previous PRs.Main Changes
Protobuf Schema (
protobuf/rpc_extractor.proto)NetworkInfomessage with allgetnetworkinfofieldsNetworkInfoNetworkfor per-network information (ipv4, ipv6, onion, i2p, cjdns)NetworkInfoLocalAddressfor local addressesrpcmessage'soneof rpc_eventType Conversions (
shared/src/protobuf/rpc_extractor.rs)From<>conversions fromcorepc_node::vtype::GetNetworkInfofmt::Displayimplementations for loggingwarningsfield (Vec → String)RPC Extractor (
extractors/rpc/src/lib.rs)--disable-getnetworkinfogetnetworkinfo()function that queries and publishes eventsdisable_allcheckPrometheus Metrics (
tools/metrics/src/metrics.rsandlib.rs)rpc_networkinfo_networksusingIntGaugeVecwith labels[network, property](following lesson from PR rpc-extractor: add getmemoryinfo and getaddrmaninfo #309)handle_rpc_event()Integration Tests
test_integration_rpc_getnetworkinfotestdisable_getnetworkinfoparameterDocumentation
Privacy Analysis:
getnetworkinfoRPC ExtractorData Exposed
Network Information (Low Sensitivity)
version,subversion,protocol_version: Already exposed in P2P handshakesconnections,connections_in,connections_out: Aggregated counts, do not identify specific peersnetwork_active,networks[]: Connectivity state, not sensitiverelay_fee,incremental_fee: Public node configurationInformation with Privacy Considerations
local_addresses[]: IP/onion addresses where the node is listeningaddr/addrv2messages)warnings: May reveal problematic node statesSecurity Measures Implemented
--rpc-user/--rpc-cookie-file)