mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
[net] Remove asmap argument from CNode::CopyStats()
This saves passing around a reference to the asmap std::vector<bool>.
This commit is contained in:
parent
9fd5618610
commit
853c4edb70
3 changed files with 5 additions and 9 deletions
|
@ -552,14 +552,13 @@ Network CNode::ConnectedThroughNetwork() const
|
|||
|
||||
#undef X
|
||||
#define X(name) stats.name = name
|
||||
void CNode::CopyStats(CNodeStats& stats, const std::vector<bool>& asmap)
|
||||
void CNode::CopyStats(CNodeStats& stats)
|
||||
{
|
||||
stats.nodeid = this->GetId();
|
||||
X(nServices);
|
||||
X(addr);
|
||||
X(addrBind);
|
||||
stats.m_network = ConnectedThroughNetwork();
|
||||
stats.m_mapped_as = addr.GetMappedAS(asmap);
|
||||
if (m_tx_relay != nullptr) {
|
||||
LOCK(m_tx_relay->cs_filter);
|
||||
stats.fRelayTxes = m_tx_relay->fRelayTxes;
|
||||
|
@ -2804,7 +2803,8 @@ void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats) const
|
|||
vstats.reserve(vNodes.size());
|
||||
for (CNode* pnode : vNodes) {
|
||||
vstats.emplace_back();
|
||||
pnode->CopyStats(vstats.back(), addrman.GetAsmap());
|
||||
pnode->CopyStats(vstats.back());
|
||||
vstats.back().m_mapped_as = pnode->addr.GetMappedAS(addrman.GetAsmap());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -652,7 +652,7 @@ public:
|
|||
|
||||
void CloseSocketDisconnect();
|
||||
|
||||
void CopyStats(CNodeStats& stats, const std::vector<bool>& asmap);
|
||||
void CopyStats(CNodeStats& stats);
|
||||
|
||||
ServiceFlags GetLocalServices() const
|
||||
{
|
||||
|
|
|
@ -39,12 +39,8 @@ FUZZ_TARGET_INIT(net, initialize_net)
|
|||
node.CloseSocketDisconnect();
|
||||
},
|
||||
[&] {
|
||||
const std::vector<bool> asmap = ConsumeRandomLengthBitVector(fuzzed_data_provider);
|
||||
if (!SanityCheckASMap(asmap, 128)) {
|
||||
return;
|
||||
}
|
||||
CNodeStats stats;
|
||||
node.CopyStats(stats, asmap);
|
||||
node.CopyStats(stats);
|
||||
},
|
||||
[&] {
|
||||
const CNode* add_ref_node = node.AddRef();
|
||||
|
|
Loading…
Add table
Reference in a new issue