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

Function rest_chaininfo

src/rest.cpp:717–739  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715RPCMethod getblockchaininfo();
716
717static bool rest_chaininfo(const std::any& context, HTTPRequest* req, const std::string& uri_part)
718{
719 if (!CheckWarmup(req))
720 return false;
721 std::string param;
722 const RESTResponseFormat rf = ParseDataFormat(param, uri_part);
723
724 switch (rf) {
725 case RESTResponseFormat::JSON: {
726 JSONRPCRequest jsonRequest;
727 jsonRequest.context = context;
728 jsonRequest.params = UniValue(UniValue::VARR);
729 UniValue chainInfoObject = getblockchaininfo().HandleRequest(jsonRequest);
730 std::string strJSON = chainInfoObject.write() + "\n";
731 req->WriteHeader("Content-Type", "application/json");
732 req->WriteReply(HTTP_OK, strJSON);
733 return true;
734 }
735 default: {
736 return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: json)");
737 }
738 }
739}
740
741
742RPCMethod getdeploymentinfo();

Callers

nothing calls this directly

Calls 9

CheckWarmupFunction · 0.85
ParseDataFormatFunction · 0.85
getblockchaininfoFunction · 0.85
RESTERRFunction · 0.85
HandleRequestMethod · 0.80
WriteHeaderMethod · 0.80
UniValueClass · 0.70
writeMethod · 0.45
WriteReplyMethod · 0.45

Tested by

no test coverage detected