| 559 | RPCHelpMan getblockchaininfo(); |
| 560 | |
| 561 | static 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 | |
| 585 | static bool rest_mempool_info(const std::any& context, HTTPRequest* req, const std::string& strURIPart) |
| 586 | { |
nothing calls this directly
no test coverage detected