mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Merge bitcoin/bitcoin#27412: logging, net: add ASN from peers on logs
0076bed45elogging: log ASN when using `-asmap` (brunoerg)9836c76ae0net: add `GetMappedAS` in `CConnman` (brunoerg) Pull request description: When using `-asmap`, you can check the ASN assigned to the peers only with the RPC command `getpeerinfo` (check `mapped_as` field), however, it's not possible to check it in logs (e.g. see in logs the ASN of the peers when a new outbound peer has been connected). This PR includes the peers' ASN in debug output when using `-asmap`. Obs: Open this primarily to chase some Concept ACK, I've been using this on my node to facilitate to track the peers' ASN especially when reading the logs. ACKs for top commit: Sjors: tACK0076bed45ejamesob: ACK0076bed45e([`jamesob/ackr/27412.1.brunoerg.logging_net_add_asn_from`](https://github.com/jamesob/bitcoin/tree/ackr/27412.1.brunoerg.logging_net_add_asn_from)) achow101: ACK0076bed45eTree-SHA512: c19cd11e8ab49962021f390459aadf6d33d221ae9a2c3df331a25d6865a8df470e2c8828f6e5219b8a887d6ab5b3450d34be9e26c00cca4d223b4ca64d51111b
This commit is contained in:
@@ -2614,6 +2614,11 @@ size_t CConnman::GetNodeCount(ConnectionDirection flags) const
|
||||
return nNum;
|
||||
}
|
||||
|
||||
uint32_t CConnman::GetMappedAS(const CNetAddr& addr) const
|
||||
{
|
||||
return m_netgroupman.GetMappedAS(addr);
|
||||
}
|
||||
|
||||
void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats) const
|
||||
{
|
||||
vstats.clear();
|
||||
@@ -2622,7 +2627,7 @@ void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats) const
|
||||
for (CNode* pnode : m_nodes) {
|
||||
vstats.emplace_back();
|
||||
pnode->CopyStats(vstats.back());
|
||||
vstats.back().m_mapped_as = m_netgroupman.GetMappedAS(pnode->addr);
|
||||
vstats.back().m_mapped_as = GetMappedAS(pnode->addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user