mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-17 19:10:40 +01:00
Return mapped AS in RPC call getpeerinfo
If ASN bucketing is used, return a corresponding AS used in bucketing for a given peer.
This commit is contained in:
@@ -493,12 +493,13 @@ void CNode::SetAddrLocal(const CService& addrLocalIn) {
|
||||
|
||||
#undef X
|
||||
#define X(name) stats.name = name
|
||||
void CNode::copyStats(CNodeStats &stats)
|
||||
void CNode::copyStats(CNodeStats &stats, std::vector<bool> &m_asmap)
|
||||
{
|
||||
stats.nodeid = this->GetId();
|
||||
X(nServices);
|
||||
X(addr);
|
||||
X(addrBind);
|
||||
stats.m_mapped_as = addr.GetMappedAS(m_asmap);
|
||||
if (m_tx_relay != nullptr) {
|
||||
LOCK(m_tx_relay->cs_filter);
|
||||
stats.fRelayTxes = m_tx_relay->fRelayTxes;
|
||||
@@ -2491,7 +2492,7 @@ void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats)
|
||||
vstats.reserve(vNodes.size());
|
||||
for (CNode* pnode : vNodes) {
|
||||
vstats.emplace_back();
|
||||
pnode->copyStats(vstats.back());
|
||||
pnode->copyStats(vstats.back(), addrman.m_asmap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user