diff options
author | dergoegge <n.goeggi@gmail.com> | 2023-11-27 17:22:41 +0000 |
---|---|---|
committer | stickies-v <stickies-v@protonmail.com> | 2024-04-10 17:01:27 +0200 |
commit | 7d9c3ec622d73a98d07ab3cee78751718982a5bc (patch) | |
tree | 1ca23797dae50e9d814a2512128199457e235a8c /src/net_processing.cpp | |
parent | ee178dfcc1175e0af8163216c9c024f4bfc97965 (diff) |
[net processing] Introduce PeerManagerInfo
For querying statistics/info from PeerManager. The median outbound time
offset is the only initial field.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index b549178677..6289d13989 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -518,6 +518,7 @@ public: std::optional<std::string> FetchBlock(NodeId peer_id, const CBlockIndex& block_index) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) const override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); + PeerManagerInfo GetInfo() const override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); bool IgnoresIncomingTxs() override { return m_opts.ignore_incoming_txs; } void SendPings() override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); void RelayTransaction(const uint256& txid, const uint256& wtxid) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); @@ -1804,6 +1805,13 @@ bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) c return true; } +PeerManagerInfo PeerManagerImpl::GetInfo() const +{ + return PeerManagerInfo{ + .median_outbound_time_offset = m_outbound_time_offsets.Median(), + }; +} + void PeerManagerImpl::AddToCompactExtraTransactions(const CTransactionRef& tx) { if (m_opts.max_extra_txs <= 0) |