Skip to content

Commit 64e50cb

Browse files
committed
Add mempool/fee_histogram option to rest API
1 parent b9b320c commit 64e50cb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rest.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,8 @@ static bool rest_mempool(const std::any& context, HTTPRequest* req, const std::s
651651

652652
std::string param;
653653
const RESTResponseFormat rf = ParseDataFormat(param, str_uri_part);
654-
if (param != "contents" && param != "info") {
655-
return RESTERR(req, HTTP_BAD_REQUEST, "Invalid URI format. Expected /rest/mempool/<info|contents>.json");
654+
if (param != "contents" && param != "info" && param != "info/with_fee_histogram") {
655+
return RESTERR(req, HTTP_BAD_REQUEST, "Invalid URI format. Expected /rest/mempool/<info|info/with_fee_histogram|contents>.json");
656656
}
657657

658658
const CTxMemPool* mempool = GetMemPool(context, req);
@@ -686,6 +686,8 @@ static bool rest_mempool(const std::any& context, HTTPRequest* req, const std::s
686686
return RESTERR(req, HTTP_BAD_REQUEST, "Verbose results cannot contain mempool sequence values. (hint: set \"verbose=false\")");
687687
}
688688
str_json = MempoolToJSON(*mempool, verbose, mempool_sequence).write() + "\n";
689+
} else if (param == "info/with_fee_histogram") {
690+
str_json = MempoolInfoToJSON(*mempool, MempoolInfoToJSON_const_histogram_floors).write() + "\n";
689691
} else {
690692
str_json = MempoolInfoToJSON(*mempool, std::nullopt).write() + "\n";
691693
}

0 commit comments

Comments
 (0)