MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / refreshPeers

Method refreshPeers

src/qt/peertablemodel.cpp:60–87  ·  view source on GitHub ↗

Pull a full list of peers from vNodes into our cache */

Source from the content-addressed store, hash-verified

58
59 /** Pull a full list of peers from vNodes into our cache */
60 void refreshPeers(interfaces::Node& node)
61 {
62 {
63 cachedNodeStats.clear();
64
65 interfaces::Node::NodesStats nodes_stats;
66 node.getNodesStats(nodes_stats);
67 cachedNodeStats.reserve(nodes_stats.size());
68 for (auto& node_stats : nodes_stats)
69 {
70 CNodeCombinedStats stats;
71 stats.nodeStats = std::get<0>(node_stats);
72 stats.fNodeStateStatsAvailable = std::get<1>(node_stats);
73 stats.nodeStateStats = std::get<2>(node_stats);
74 cachedNodeStats.append(stats);
75 }
76 }
77
78 if (sortColumn >= 0)
79 // sort cacheNodeStats (use stable sort to prevent rows jumping around unnecessarily)
80 qStableSort(cachedNodeStats.begin(), cachedNodeStats.end(), NodeLessThan(sortColumn, sortOrder));
81
82 // build index map
83 mapNodeRows.clear();
84 int row = 0;
85 for (const CNodeCombinedStats& stats : cachedNodeStats)
86 mapNodeRows.insert(std::pair<NodeId, int>(stats.nodeStats.nodeid, row++));
87 }
88
89 int size() const
90 {

Callers 1

refreshMethod · 0.80

Calls 8

NodeLessThanClass · 0.85
getNodesStatsMethod · 0.80
clearMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected