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

Function getnetworkinfo

src/rpc/net.cpp:572–666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

570}
571
572static RPCHelpMan getnetworkinfo()
573{
574 return RPCHelpMan{"getnetworkinfo",
575 "Returns an object containing various state info regarding P2P networking.\n",
576 {},
577 RPCResult{
578 RPCResult::Type::OBJ, "", "",
579 {
580 {RPCResult::Type::NUM, "version", "the server version"},
581 {RPCResult::Type::STR, "subversion", "the server subversion string"},
582 {RPCResult::Type::NUM, "protocolversion", "the protocol version"},
583 {RPCResult::Type::STR_HEX, "localservices", "the services we offer to the network"},
584 {RPCResult::Type::ARR, "localservicesnames", "the services we offer to the network, in human-readable form",
585 {
586 {RPCResult::Type::STR, "SERVICE_NAME", "the service name"},
587 }},
588 {RPCResult::Type::BOOL, "localrelay", "true if transaction relay is requested from peers"},
589 {RPCResult::Type::NUM, "timeoffset", "the time offset"},
590 {RPCResult::Type::NUM, "connections", "the total number of connections"},
591 {RPCResult::Type::NUM, "connections_in", "the number of inbound connections"},
592 {RPCResult::Type::NUM, "connections_out", "the number of outbound connections"},
593 {RPCResult::Type::BOOL, "networkactive", "whether p2p networking is enabled"},
594 {RPCResult::Type::ARR, "networks", "information per network",
595 {
596 {RPCResult::Type::OBJ, "", "",
597 {
598 {RPCResult::Type::STR, "name", "network (" + Join(GetNetworkNames(), ", ") + ")"},
599 {RPCResult::Type::BOOL, "limited", "is the network limited using -onlynet?"},
600 {RPCResult::Type::BOOL, "reachable", "is the network reachable?"},
601 {RPCResult::Type::STR, "proxy", "(\"host:port\") the proxy that is used for this network, or empty if none"},
602 {RPCResult::Type::BOOL, "proxy_randomize_credentials", "Whether randomized credentials are used"},
603 }},
604 }},
605 {RPCResult::Type::NUM, "relayfee", "minimum relay fee rate for transactions in " + CURRENCY_UNIT + "/kvB"},
606 {RPCResult::Type::NUM, "incrementalfee", "minimum fee rate increment for mempool limiting or BIP 125 replacement in " + CURRENCY_UNIT + "/kvB"},
607 {RPCResult::Type::ARR, "localaddresses", "list of local addresses",
608 {
609 {RPCResult::Type::OBJ, "", "",
610 {
611 {RPCResult::Type::STR, "address", "network address"},
612 {RPCResult::Type::NUM, "port", "network port"},
613 {RPCResult::Type::NUM, "score", "relative score"},
614 }},
615 }},
616 {RPCResult::Type::STR, "warnings", "any network and blockchain warnings"},
617 }
618 },
619 RPCExamples{
620 HelpExampleCli("getnetworkinfo", "")
621 + HelpExampleRpc("getnetworkinfo", "")
622 },
623 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
624{
625 LOCK(cs_main);
626 UniValue obj(UniValue::VOBJ);
627 obj.pushKV("version", CLIENT_VERSION);
628 obj.pushKV("subversion", strSubVersion);
629 obj.pushKV("protocolversion",PROTOCOL_VERSION);

Callers

nothing calls this directly

Calls 15

JoinFunction · 0.85
GetNetworkNamesFunction · 0.85
HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
GetServicesNamesFunction · 0.85
GetTimeOffsetFunction · 0.85
GetNetworksInfoFunction · 0.85
ValueFromAmountFunction · 0.85
GetWarningsFunction · 0.85
IgnoresIncomingTxsMethod · 0.80
GetNetworkActiveMethod · 0.80
GetNodeCountMethod · 0.80

Tested by

no test coverage detected