| 583 | } |
| 584 | |
| 585 | static bool rest_mempool_info(const std::any& context, HTTPRequest* req, const std::string& strURIPart) |
| 586 | { |
| 587 | if (!CheckWarmup(req)) |
| 588 | return false; |
| 589 | const CTxMemPool* mempool = GetMemPool(context, req); |
| 590 | if (!mempool) return false; |
| 591 | std::string param; |
| 592 | const RetFormat rf = ParseDataFormat(param, strURIPart); |
| 593 | |
| 594 | switch (rf) { |
| 595 | case RetFormat::JSON: { |
| 596 | UniValue mempoolInfoObject = MempoolInfoToJSON(*mempool); |
| 597 | |
| 598 | std::string strJSON = mempoolInfoObject.write() + "\n"; |
| 599 | req->WriteHeader("Content-Type", "application/json"); |
| 600 | req->WriteReply(HTTP_OK, strJSON); |
| 601 | return true; |
| 602 | } |
| 603 | default: { |
| 604 | return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: json)"); |
| 605 | } |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | static bool rest_mempool_contents(const std::any& context, HTTPRequest* req, const std::string& strURIPart) |
| 610 | { |
nothing calls this directly
no test coverage detected