MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / getconnectioncount

Function getconnectioncount

src/rpc/net.cpp:67–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65};
66
67static RPCMethod getconnectioncount()
68{
69 return RPCMethod{
70 "getconnectioncount",
71 "Returns the number of connections to other nodes.\n",
72 {},
73 RPCResult{
74 RPCResult::Type::NUM, "", "The connection count"
75 },
76 RPCExamples{
77 HelpExampleCli("getconnectioncount", "")
78 + HelpExampleRpc("getconnectioncount", "")
79 },
80 [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
81{
82 NodeContext& node = EnsureAnyNodeContext(request.context);
83 const CConnman& connman = EnsureConnman(node);
84
85 return connman.GetNodeCount(ConnectionDirection::Both);
86},
87 };
88}
89
90static RPCMethod ping()
91{

Callers

nothing calls this directly

Calls 3

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
GetNodeCountMethod · 0.80

Tested by

no test coverage detected