mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-01 19:21:28 +02:00
rest/rpc: Make mempoolinfo atomic
This commit is contained in:
@ -1483,6 +1483,8 @@ static UniValue getchaintips(const JSONRPCRequest& request)
|
|||||||
|
|
||||||
UniValue MempoolInfoToJSON(const CTxMemPool& pool)
|
UniValue MempoolInfoToJSON(const CTxMemPool& pool)
|
||||||
{
|
{
|
||||||
|
// Make sure this call is atomic in the pool.
|
||||||
|
LOCK(pool.cs);
|
||||||
UniValue ret(UniValue::VOBJ);
|
UniValue ret(UniValue::VOBJ);
|
||||||
ret.pushKV("size", (int64_t)pool.size());
|
ret.pushKV("size", (int64_t)pool.size());
|
||||||
ret.pushKV("bytes", (int64_t)pool.GetTotalTxSize());
|
ret.pushKV("bytes", (int64_t)pool.GetTotalTxSize());
|
||||||
|
Reference in New Issue
Block a user