MCPcopy Create free account
hub / github.com/ElementsProject/elements / rest_mempool_contents

Function rest_mempool_contents

src/rest.cpp:609–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607}
608
609static 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
632static bool rest_tx(const std::any& context, HTTPRequest* req, const std::string& strURIPart)
633{

Callers

nothing calls this directly

Calls 8

CheckWarmupFunction · 0.85
GetMemPoolFunction · 0.85
ParseDataFormatFunction · 0.85
MempoolToJSONFunction · 0.85
RESTERRFunction · 0.85
WriteHeaderMethod · 0.80
WriteReplyMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected