| 742 | RPCMethod getdeploymentinfo(); |
| 743 | |
| 744 | static 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 | |
| 783 | static bool rest_mempool(const std::any& context, HTTPRequest* req, const std::string& str_uri_part) |
| 784 | { |
nothing calls this directly
no test coverage detected