diff --git a/src/net.cpp b/src/net.cpp index 1cb6528b1d..819d75cb4e 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -3361,6 +3361,9 @@ size_t CConnman::GetNodeCount(NumConnections flags) if (pnode->fDisconnect) { continue; } + if ((flags & CONNECTIONS_VERIFIED) && pnode->GetVerifiedProRegTxHash().IsNull()) { + continue; + } if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT)) { nNum++; } diff --git a/src/net.h b/src/net.h index f0cf7870f2..1ca626b351 100644 --- a/src/net.h +++ b/src/net.h @@ -142,6 +142,9 @@ public: CONNECTIONS_IN = (1U << 0), CONNECTIONS_OUT = (1U << 1), CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT), + CONNECTIONS_VERIFIED = (1U << 2), + CONNECTIONS_VERIFIED_IN = (CONNECTIONS_VERIFIED | CONNECTIONS_IN), + CONNECTIONS_VERIFIED_OUT = (CONNECTIONS_VERIFIED | CONNECTIONS_OUT), }; enum SocketEventsMode { diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 317888e8b2..47bbd5cbf7 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -494,7 +494,12 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request) " ],\n" " \"localrelay\" : true|false, (boolean) true if transaction relay is requested from peers\n" " \"timeoffset\" : xxxxx, (numeric) the time offset\n" - " \"connections\" : xxxxx, (numeric) the number of connections\n" + " \"connections\" : xxxxx, (numeric) the number of inbound and outbound connections\n" + " \"inboundconnections\" : xxxxx, (numeric) the number of inbound connections\n" + " \"outboundconnections\" : xxxxx, (numeric) the number of outbound connections\n" + " \"mnconnections\" : xxxxx, (numeric) the number of verified mn connections\n" + " \"inboundmnconnections\" : xxxxx, (numeric) the number of inbound verified mn connections\n" + " \"outboundmnconnections\" : xxxxx, (numeric) the number of outbound verified mn connections\n" " \"networkactive\" : true|false, (boolean) whether p2p networking is enabled\n" " \"socketevents\" : \"xxx/\", (string) the socket events mode, either kqueue, epoll, poll or select\n" " \"networks\" : [ (json array) information per network\n" @@ -542,6 +547,11 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request) if (g_connman) { obj.pushKV("networkactive", g_connman->GetNetworkActive()); obj.pushKV("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL)); + obj.pushKV("inboundconnections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_IN)); + obj.pushKV("outboundconnections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_OUT)); + obj.pushKV("mnconnections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_VERIFIED)); + obj.pushKV("inboundmnconnections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_VERIFIED_IN)); + obj.pushKV("outboundmnconnections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_VERIFIED_OUT)); std::string strSocketEvents; switch (g_connman->GetSocketEventsMode()) { case CConnman::SOCKETEVENTS_SELECT: