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

Function getnetworkinfo

src/rpc/net.cpp:644–749  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

642}
643
644static RPCMethod getnetworkinfo()
645{
646 return RPCMethod{"getnetworkinfo",
647 "Returns an object containing various state info regarding P2P networking.\n",
648 {},
649 RPCResult{
650 RPCResult::Type::OBJ, "", "",
651 {
652 {RPCResult::Type::NUM, "version", "the server version"},
653 {RPCResult::Type::STR, "subversion", "the server subversion string"},
654 {RPCResult::Type::NUM, "protocolversion", "the protocol version"},
655 {RPCResult::Type::STR_HEX, "localservices", "the services we offer to the network"},
656 {RPCResult::Type::ARR, "localservicesnames", "the services we offer to the network, in human-readable form",
657 {
658 {RPCResult::Type::STR, "SERVICE_NAME", "the service name"},
659 }},
660 {RPCResult::Type::BOOL, "localrelay", "true if transaction relay is requested from peers"},
661 {RPCResult::Type::NUM, "timeoffset", "the time offset"},
662 {RPCResult::Type::NUM, "connections", "the total number of connections"},
663 {RPCResult::Type::NUM, "connections_in", "the number of inbound connections"},
664 {RPCResult::Type::NUM, "connections_out", "the number of outbound connections"},
665 {RPCResult::Type::BOOL, "networkactive", "whether p2p networking is enabled"},
666 {RPCResult::Type::ARR, "networks", "information per network",
667 {
668 {RPCResult::Type::OBJ, "", "",
669 {
670 {RPCResult::Type::STR, "name", "network (" + Join(GetNetworkNames(), ", ") + ")"},
671 {RPCResult::Type::BOOL, "limited", "is the network limited using -onlynet?"},
672 {RPCResult::Type::BOOL, "reachable", "is the network reachable?"},
673 {RPCResult::Type::STR, "proxy", "(\"host:port\") the proxy that is used for this network, or empty if none"},
674 {RPCResult::Type::BOOL, "proxy_randomize_credentials", "Whether randomized credentials are used"},
675 }},
676 }},
677 {RPCResult::Type::NUM, "relayfee", "minimum relay fee rate for transactions in " + CURRENCY_UNIT + "/kvB"},
678 {RPCResult::Type::NUM, "incrementalfee", "minimum fee rate increment for mempool limiting or replacement in " + CURRENCY_UNIT + "/kvB"},
679 {RPCResult::Type::ARR, "localaddresses", "list of local addresses",
680 {
681 {RPCResult::Type::OBJ, "", "",
682 {
683 {RPCResult::Type::STR, "address", "network address"},
684 {RPCResult::Type::NUM, "port", "network port"},
685 {RPCResult::Type::NUM, "score", "relative score"},
686 }},
687 }},
688 (IsDeprecatedRPCEnabled("warnings") ?
689 RPCResult{RPCResult::Type::STR, "warnings", "any network and blockchain warnings (DEPRECATED)"} :
690 RPCResult{RPCResult::Type::ARR, "warnings", "any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)",
691 {
692 {RPCResult::Type::STR, "", "warning"},
693 }
694 }
695 ),
696 }
697 },
698 RPCExamples{
699 HelpExampleCli("getnetworkinfo", "")
700 + HelpExampleRpc("getnetworkinfo", "")
701 },

Callers

nothing calls this directly

Calls 15

JoinFunction · 0.85
GetNetworkNamesFunction · 0.85
IsDeprecatedRPCEnabledFunction · 0.85
HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
GetServicesNamesFunction · 0.85
GetNetworksInfoFunction · 0.85
ValueFromAmountFunction · 0.85
GetWarningsForRpcFunction · 0.85
pushKVMethod · 0.80
GetLocalServicesMethod · 0.80
GetNetworkActiveMethod · 0.80

Tested by

no test coverage detected