MCPcopy Create free account
hub / github.com/ElementsProject/elements / getNodesStats

Method getNodesStats

src/node/interfaces.cpp:121–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119 return m_context->connman ? m_context->connman->GetNodeCount(flags) : 0;
120 }
121 bool getNodesStats(NodesStats& stats) override
122 {
123 stats.clear();
124
125 if (m_context->connman) {
126 std::vector<CNodeStats> stats_temp;
127 m_context->connman->GetNodeStats(stats_temp);
128
129 stats.reserve(stats_temp.size());
130 for (auto& node_stats_temp : stats_temp) {
131 stats.emplace_back(std::move(node_stats_temp), false, CNodeStateStats());
132 }
133
134 // Try to retrieve the CNodeStateStats for each node.
135 if (m_context->peerman) {
136 TRY_LOCK(::cs_main, lockMain);
137 if (lockMain) {
138 for (auto& node_stats : stats) {
139 std::get<1>(node_stats) =
140 m_context->peerman->GetNodeStateStats(std::get<0>(node_stats).nodeid, std::get<2>(node_stats));
141 }
142 }
143 }
144 return true;
145 }
146 return false;
147 }
148 bool getBanned(banmap_t& banmap) override
149 {
150 if (m_context->banman) {

Callers 1

refreshMethod · 0.80

Calls 7

GetNodeStatsMethod · 0.80
emplace_backMethod · 0.80
GetNodeStateStatsMethod · 0.80
CNodeStateStatsClass · 0.50
clearMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected