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

Function rest_mempool_info

src/rest.cpp:585–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

583}
584
585static 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
609static bool rest_mempool_contents(const std::any& context, HTTPRequest* req, const std::string& strURIPart)
610{

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected