mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Closely track mempool byte total. Add "getmempoolinfo" RPC.
Goal: Gain live insight into the mempool. Groundwork for future work that caps mempool size.
This commit is contained in:
@@ -531,3 +531,27 @@ Value getchaintips(const Array& params, bool fHelp)
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
Value getmempoolinfo(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getmempoolinfo\n"
|
||||
"\nReturns details on the active state of the TX memory pool.\n"
|
||||
"\nResult:\n"
|
||||
"{\n"
|
||||
" \"size\": xxxxx (numeric) Current tx count\n"
|
||||
" \"bytes\": xxxxx (numeric) Sum of all tx sizes\n"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("getmempoolinfo", "")
|
||||
+ HelpExampleRpc("getmempoolinfo", "")
|
||||
);
|
||||
|
||||
Object ret;
|
||||
ret.push_back(Pair("size", (int64_t) mempool.size()));
|
||||
ret.push_back(Pair("bytes", (int64_t) mempool.GetTotalTxSize()));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user