mirror of https://github.com/bitcoin/bitcoin.git
rpc/net: add per-peer inv_to_send sizes
This commit is contained in:
parent
dadf15f88c
commit
adefb51c54
|
@ -1728,9 +1728,11 @@ bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) c
|
|||
if (auto tx_relay = peer->GetTxRelay(); tx_relay != nullptr) {
|
||||
stats.m_relay_txs = WITH_LOCK(tx_relay->m_bloom_filter_mutex, return tx_relay->m_relay_txs);
|
||||
stats.m_fee_filter_received = tx_relay->m_fee_filter_received.load();
|
||||
stats.m_inv_to_send = WITH_LOCK(tx_relay->m_tx_inventory_mutex, return tx_relay->m_tx_inventory_to_send.size());
|
||||
} else {
|
||||
stats.m_relay_txs = false;
|
||||
stats.m_fee_filter_received = 0;
|
||||
stats.m_inv_to_send = 0;
|
||||
}
|
||||
|
||||
stats.m_ping_wait = ping_wait;
|
||||
|
|
|
@ -54,6 +54,7 @@ struct CNodeStateStats {
|
|||
std::chrono::microseconds m_ping_wait;
|
||||
std::vector<int> vHeightInFlight;
|
||||
bool m_relay_txs;
|
||||
int m_inv_to_send = 0;
|
||||
CAmount m_fee_filter_received;
|
||||
uint64_t m_addr_processed = 0;
|
||||
uint64_t m_addr_rate_limited = 0;
|
||||
|
|
|
@ -142,6 +142,7 @@ static RPCHelpMan getpeerinfo()
|
|||
{RPCResult::Type::STR, "SERVICE_NAME", "the service name if it is recognised"}
|
||||
}},
|
||||
{RPCResult::Type::BOOL, "relaytxes", "Whether we relay transactions to this peer"},
|
||||
{RPCResult::Type::NUM, "inv_to_send", "How many txs we have queued to announce to this peer"},
|
||||
{RPCResult::Type::NUM_TIME, "lastsend", "The " + UNIX_EPOCH_TIME + " of the last send"},
|
||||
{RPCResult::Type::NUM_TIME, "lastrecv", "The " + UNIX_EPOCH_TIME + " of the last receive"},
|
||||
{RPCResult::Type::NUM_TIME, "last_transaction", "The " + UNIX_EPOCH_TIME + " of the last valid transaction received from this peer"},
|
||||
|
@ -238,6 +239,7 @@ static RPCHelpMan getpeerinfo()
|
|||
obj.pushKV("services", strprintf("%016x", services));
|
||||
obj.pushKV("servicesnames", GetServicesNames(services));
|
||||
obj.pushKV("relaytxes", statestats.m_relay_txs);
|
||||
obj.pushKV("inv_to_send", statestats.m_inv_to_send);
|
||||
obj.pushKV("lastsend", count_seconds(stats.m_last_send));
|
||||
obj.pushKV("lastrecv", count_seconds(stats.m_last_recv));
|
||||
obj.pushKV("last_transaction", count_seconds(stats.m_last_tx_time));
|
||||
|
|
|
@ -166,6 +166,7 @@ class NetTest(BitcoinTestFramework):
|
|||
"permissions": [],
|
||||
"presynced_headers": -1,
|
||||
"relaytxes": False,
|
||||
"inv_to_send": 0,
|
||||
"services": "0000000000000000",
|
||||
"servicesnames": [],
|
||||
"session_id": "" if not self.options.v2transport else no_version_peer.v2_state.peer['session_id'].hex(),
|
||||
|
|
Loading…
Reference in New Issue