Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/net.cpp
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
{RPCResult::Type::STR, "subver", "The string version"}, | {RPCResult::Type::STR, "subver", "The string version"}, | ||||
{RPCResult::Type::BOOL, "inbound", | {RPCResult::Type::BOOL, "inbound", | ||||
"Inbound (true) or Outbound (false)"}, | "Inbound (true) or Outbound (false)"}, | ||||
{RPCResult::Type::BOOL, "addnode", | {RPCResult::Type::BOOL, "addnode", | ||||
"Whether connection was due to addnode/-connect or if it " | "Whether connection was due to addnode/-connect or if it " | ||||
"was an automatic/inbound connection"}, | "was an automatic/inbound connection"}, | ||||
{RPCResult::Type::NUM, "startingheight", | {RPCResult::Type::NUM, "startingheight", | ||||
"The starting height (block) of the peer"}, | "The starting height (block) of the peer"}, | ||||
{RPCResult::Type::NUM, "banscore", "The ban score"}, | {RPCResult::Type::NUM, "banscore", | ||||
"The ban score (DEPRECATED, returned only if config " | |||||
"option -deprecatedrpc=banscore is passed)"}, | |||||
{RPCResult::Type::NUM, "synced_headers", | {RPCResult::Type::NUM, "synced_headers", | ||||
"The last header we have in common with this peer"}, | "The last header we have in common with this peer"}, | ||||
{RPCResult::Type::NUM, "synced_blocks", | {RPCResult::Type::NUM, "synced_blocks", | ||||
"The last block we have in common with this peer"}, | "The last block we have in common with this peer"}, | ||||
{RPCResult::Type::ARR, | {RPCResult::Type::ARR, | ||||
"inflight", | "inflight", | ||||
"", | "", | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | for (const CNodeStats &stats : vstats) { | ||||
// Use the sanitized form of subver here, to avoid tricksy remote peers | // Use the sanitized form of subver here, to avoid tricksy remote peers | ||||
// from corrupting or modifying the JSON output by putting special | // from corrupting or modifying the JSON output by putting special | ||||
// characters in their ver message. | // characters in their ver message. | ||||
obj.pushKV("subver", stats.cleanSubVer); | obj.pushKV("subver", stats.cleanSubVer); | ||||
obj.pushKV("inbound", stats.fInbound); | obj.pushKV("inbound", stats.fInbound); | ||||
obj.pushKV("addnode", stats.m_manual_connection); | obj.pushKV("addnode", stats.m_manual_connection); | ||||
obj.pushKV("startingheight", stats.nStartingHeight); | obj.pushKV("startingheight", stats.nStartingHeight); | ||||
if (fStateStats) { | if (fStateStats) { | ||||
if (IsDeprecatedRPCEnabled(gArgs, "banscore")) { | |||||
// banscore is deprecated in v0.22.11 for removal in v0.23 | |||||
obj.pushKV("banscore", statestats.nMisbehavior); | obj.pushKV("banscore", statestats.nMisbehavior); | ||||
} | |||||
obj.pushKV("synced_headers", statestats.nSyncHeight); | obj.pushKV("synced_headers", statestats.nSyncHeight); | ||||
obj.pushKV("synced_blocks", statestats.nCommonHeight); | obj.pushKV("synced_blocks", statestats.nCommonHeight); | ||||
UniValue heights(UniValue::VARR); | UniValue heights(UniValue::VARR); | ||||
for (const int height : statestats.vHeightInFlight) { | for (const int height : statestats.vHeightInFlight) { | ||||
heights.push_back(height); | heights.push_back(height); | ||||
} | } | ||||
obj.pushKV("inflight", heights); | obj.pushKV("inflight", heights); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 727 Lines • Show Last 20 Lines |