aboutsummaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2020-08-24 17:39:54 +0100
committerJohn Newbery <john@johnnewbery.com>2020-12-04 11:37:45 +0000
commita529fd3e3f2391e592ac937e291fec51e067ea2e (patch)
treeeafa7eadf6bfe611afe40a3bb8d325cbef602c18 /src/node
parent257cf05f9b841ba30202f23a94bcdb1743feded2 (diff)
[net processing] Move GetNodeStateStats into PeerManager
Diffstat (limited to 'src/node')
-rw-r--r--src/node/interfaces.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp
index a8c8be05fb..3c315c0a53 100644
--- a/src/node/interfaces.cpp
+++ b/src/node/interfaces.cpp
@@ -121,11 +121,13 @@ public:
}
// Try to retrieve the CNodeStateStats for each node.
- TRY_LOCK(::cs_main, lockMain);
- if (lockMain) {
- for (auto& node_stats : stats) {
- std::get<1>(node_stats) =
- GetNodeStateStats(std::get<0>(node_stats).nodeid, std::get<2>(node_stats));
+ if (m_context->peerman) {
+ TRY_LOCK(::cs_main, lockMain);
+ if (lockMain) {
+ for (auto& node_stats : stats) {
+ std::get<1>(node_stats) =
+ m_context->peerman->GetNodeStateStats(std::get<0>(node_stats).nodeid, std::get<2>(node_stats));
+ }
}
}
return true;