MCPcopy Create free account
hub / github.com/ElementsProject/elements / getconnectioncount

Function getconnectioncount

src/rpc/net.cpp:46–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44};
45
46static RPCHelpMan getconnectioncount()
47{
48 return RPCHelpMan{"getconnectioncount",
49 "\nReturns the number of connections to other nodes.\n",
50 {},
51 RPCResult{
52 RPCResult::Type::NUM, "", "The connection count"
53 },
54 RPCExamples{
55 HelpExampleCli("getconnectioncount", "")
56 + HelpExampleRpc("getconnectioncount", "")
57 },
58 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
59{
60 NodeContext& node = EnsureAnyNodeContext(request.context);
61 const CConnman& connman = EnsureConnman(node);
62
63 return (int)connman.GetNodeCount(ConnectionDirection::Both);
64},
65 };
66}
67
68static RPCHelpMan ping()
69{

Callers

nothing calls this directly

Calls 3

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
GetNodeCountMethod · 0.80

Tested by

no test coverage detected