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

Function rest_deploymentinfo

src/rest.cpp:744–781  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742RPCMethod getdeploymentinfo();
743
744static bool rest_deploymentinfo(const std::any& context, HTTPRequest* req, const std::string& str_uri_part)
745{
746 if (!CheckWarmup(req)) return false;
747
748 std::string hash_str;
749 const RESTResponseFormat rf = ParseDataFormat(hash_str, str_uri_part);
750
751 switch (rf) {
752 case RESTResponseFormat::JSON: {
753 JSONRPCRequest jsonRequest;
754 jsonRequest.context = context;
755 jsonRequest.params = UniValue(UniValue::VARR);
756
757 if (!hash_str.empty()) {
758 auto hash{uint256::FromHex(hash_str)};
759 if (!hash) {
760 return RESTERR(req, HTTP_BAD_REQUEST, "Invalid hash: " + hash_str);
761 }
762
763 const ChainstateManager* chainman = GetChainman(context, req);
764 if (!chainman) return false;
765 if (!WITH_LOCK(::cs_main, return chainman->m_blockman.LookupBlockIndex(*hash))) {
766 return RESTERR(req, HTTP_BAD_REQUEST, "Block not found");
767 }
768
769 jsonRequest.params.push_back(hash_str);
770 }
771
772 req->WriteHeader("Content-Type", "application/json");
773 req->WriteReply(HTTP_OK, getdeploymentinfo().HandleRequest(jsonRequest).write() + "\n");
774 return true;
775 }
776 default: {
777 return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: json)");
778 }
779 }
780
781}
782
783static bool rest_mempool(const std::any& context, HTTPRequest* req, const std::string& str_uri_part)
784{

Callers

nothing calls this directly

Calls 14

CheckWarmupFunction · 0.85
ParseDataFormatFunction · 0.85
FromHexFunction · 0.85
RESTERRFunction · 0.85
GetChainmanFunction · 0.85
getdeploymentinfoFunction · 0.85
LookupBlockIndexMethod · 0.80
WriteHeaderMethod · 0.80
HandleRequestMethod · 0.80
UniValueClass · 0.70
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected