| 607 | } |
| 608 | |
| 609 | static bool rest_mempool_contents(const std::any& context, HTTPRequest* req, const std::string& strURIPart) |
| 610 | { |
| 611 | if (!CheckWarmup(req)) return false; |
| 612 | const CTxMemPool* mempool = GetMemPool(context, req); |
| 613 | if (!mempool) return false; |
| 614 | std::string param; |
| 615 | const RetFormat rf = ParseDataFormat(param, strURIPart); |
| 616 | |
| 617 | switch (rf) { |
| 618 | case RetFormat::JSON: { |
| 619 | UniValue mempoolObject = MempoolToJSON(*mempool, true); |
| 620 | |
| 621 | std::string strJSON = mempoolObject.write() + "\n"; |
| 622 | req->WriteHeader("Content-Type", "application/json"); |
| 623 | req->WriteReply(HTTP_OK, strJSON); |
| 624 | return true; |
| 625 | } |
| 626 | default: { |
| 627 | return RESTERR(req, HTTP_NOT_FOUND, "output format not found (available: json)"); |
| 628 | } |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | static bool rest_tx(const std::any& context, HTTPRequest* req, const std::string& strURIPart) |
| 633 | { |
nothing calls this directly
no test coverage detected