merge bitcoin#15474: Make mempoolinfo atomic

This commit is contained in:
Kittywhiskers Van Gogh 2021-11-08 20:20:39 +03:00
parent f9d5542daa
commit 7ae2e66612

View File

@ -1680,6 +1680,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());