| 570 | } |
| 571 | |
| 572 | static 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); |
nothing calls this directly
no test coverage detected