Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
Show First 20 Lines • Show All 467 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
{{ | {{ | ||||
RPCResult::Type::OBJ, | RPCResult::Type::OBJ, | ||||
"", | "", | ||||
"", | "", | ||||
{{ | {{ | ||||
{RPCResult::Type::NUM, "peerid", "The peer id"}, | {RPCResult::Type::NUM, "peerid", "The peer id"}, | ||||
{RPCResult::Type::STR_HEX, "proof", | {RPCResult::Type::STR_HEX, "proof", | ||||
"The avalanche proof used by this peer"}, | "The avalanche proof used by this peer"}, | ||||
{RPCResult::Type::NUM, "nodecount", | |||||
"The number of nodes for this peer"}, | |||||
{RPCResult::Type::ARR, | {RPCResult::Type::ARR, | ||||
"nodes", | "nodes", | ||||
"", | "", | ||||
{ | { | ||||
{RPCResult::Type::NUM, "nodeid", | {RPCResult::Type::NUM, "nodeid", | ||||
"Node id, as returned by getpeerinfo"}, | "Node id, as returned by getpeerinfo"}, | ||||
}}, | }}, | ||||
}}, | }}, | ||||
Show All 20 Lines | g_avalanche->withPeerManager([&](const avalanche::PeerManager &pm) { | ||||
obj.pushKV("peerid", uint64_t(peer.peerid)); | obj.pushKV("peerid", uint64_t(peer.peerid)); | ||||
obj.pushKV("proof", HexStr(serproof)); | obj.pushKV("proof", HexStr(serproof)); | ||||
UniValue nodes(UniValue::VARR); | UniValue nodes(UniValue::VARR); | ||||
pm.forEachNode(peer, [&](const avalanche::Node &n) { | pm.forEachNode(peer, [&](const avalanche::Node &n) { | ||||
nodes.push_back(n.nodeid); | nodes.push_back(n.nodeid); | ||||
}); | }); | ||||
obj.pushKV("nodes", nodes); | |||||
obj.pushKV("nodecount", uint64_t(peer.node_count)); | obj.pushKV("nodecount", uint64_t(peer.node_count)); | ||||
obj.pushKV("nodes", nodes); | |||||
ret.push_back(obj); | ret.push_back(obj); | ||||
}); | }); | ||||
}); | }); | ||||
return ret; | return ret; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 145 Lines • Show Last 20 Lines |