Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
Show First 20 Lines • Show All 789 Lines • ▼ Show 20 Lines | return 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, "proofid", | |||||
"The avalanche proof id used by this peer"}, | |||||
{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", | {RPCResult::Type::NUM, "nodecount", | ||||
"The number of nodes for this peer"}, | "The number of nodes for this peer"}, | ||||
{RPCResult::Type::ARR, | {RPCResult::Type::ARR, | ||||
"nodes", | "nodes", | ||||
"", | "", | ||||
{ | { | ||||
Show All 16 Lines | return RPCHelpMan{ | ||||
"Avalanche is not initialized"); | "Avalanche is not initialized"); | ||||
} | } | ||||
auto peerToUniv = [](const avalanche::PeerManager &pm, | auto peerToUniv = [](const avalanche::PeerManager &pm, | ||||
const avalanche::Peer &peer) { | const avalanche::Peer &peer) { | ||||
UniValue obj(UniValue::VOBJ); | UniValue obj(UniValue::VOBJ); | ||||
obj.pushKV("peerid", uint64_t(peer.peerid)); | obj.pushKV("peerid", uint64_t(peer.peerid)); | ||||
obj.pushKV("proofid", peer.getProofId().ToString()); | |||||
obj.pushKV("proof", peer.proof->ToHex()); | obj.pushKV("proof", peer.proof->ToHex()); | ||||
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("nodecount", uint64_t(peer.node_count)); | obj.pushKV("nodecount", uint64_t(peer.node_count)); | ||||
▲ Show 20 Lines • Show All 215 Lines • Show Last 20 Lines |