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

Function rest_chaininfo

src/rest.cpp:561–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559RPCHelpMan getblockchaininfo();
560
561static bool rest_chaininfo(const std::any& context, HTTPRequest* req, const std::string& strURIPart)
562{
563 if (!CheckWarmup(req))
564 return false;
565 std::string param;
566 const RetFormat rf = ParseDataFormat(param, strURIPart);
567
568 switch (rf) {
569 case RetFormat::JSON: {
570 JSONRPCRequest jsonRequest;
571 jsonRequest.context = context;
572 jsonRequest.params = UniValue(UniValue::VARR);
573 UniValue chainInfoObject = getblockchaininfo().HandleRequest(jsonRequest);
574 std::string strJSON = chainInfoObject.write() + "\n";
575 req->WriteHeader("Content-Type", "application/json");
576 req->WriteReply(HTTP_OK, strJSON);
577 return true;
578 }
579 default: {
580 return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: json)");
581 }
582 }
583}
584
585static bool rest_mempool_info(const std::any& context, HTTPRequest* req, const std::string& strURIPart)
586{

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
WriteReplyMethod · 0.80
UniValueClass · 0.70
writeMethod · 0.45

Tested by

no test coverage detected