mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
feat(rpc): getnetworkinfo RPC enrichment response (#4913)
* Enrich getnetworkinfo * Adjustements
This commit is contained in:
parent
b4ed731cb1
commit
a1f54a6079
@ -3361,6 +3361,9 @@ size_t CConnman::GetNodeCount(NumConnections flags)
|
|||||||
if (pnode->fDisconnect) {
|
if (pnode->fDisconnect) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ((flags & CONNECTIONS_VERIFIED) && pnode->GetVerifiedProRegTxHash().IsNull()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT)) {
|
if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT)) {
|
||||||
nNum++;
|
nNum++;
|
||||||
}
|
}
|
||||||
|
@ -142,6 +142,9 @@ public:
|
|||||||
CONNECTIONS_IN = (1U << 0),
|
CONNECTIONS_IN = (1U << 0),
|
||||||
CONNECTIONS_OUT = (1U << 1),
|
CONNECTIONS_OUT = (1U << 1),
|
||||||
CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT),
|
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 {
|
enum SocketEventsMode {
|
||||||
|
@ -494,7 +494,12 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request)
|
|||||||
" ],\n"
|
" ],\n"
|
||||||
" \"localrelay\" : true|false, (boolean) true if transaction relay is requested from peers\n"
|
" \"localrelay\" : true|false, (boolean) true if transaction relay is requested from peers\n"
|
||||||
" \"timeoffset\" : xxxxx, (numeric) the time offset\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"
|
" \"networkactive\" : true|false, (boolean) whether p2p networking is enabled\n"
|
||||||
" \"socketevents\" : \"xxx/\", (string) the socket events mode, either kqueue, epoll, poll or select\n"
|
" \"socketevents\" : \"xxx/\", (string) the socket events mode, either kqueue, epoll, poll or select\n"
|
||||||
" \"networks\" : [ (json array) information per network\n"
|
" \"networks\" : [ (json array) information per network\n"
|
||||||
@ -542,6 +547,11 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request)
|
|||||||
if (g_connman) {
|
if (g_connman) {
|
||||||
obj.pushKV("networkactive", g_connman->GetNetworkActive());
|
obj.pushKV("networkactive", g_connman->GetNetworkActive());
|
||||||
obj.pushKV("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL));
|
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;
|
std::string strSocketEvents;
|
||||||
switch (g_connman->GetSocketEventsMode()) {
|
switch (g_connman->GetSocketEventsMode()) {
|
||||||
case CConnman::SOCKETEVENTS_SELECT:
|
case CConnman::SOCKETEVENTS_SELECT:
|
||||||
|
Loading…
Reference in New Issue
Block a user