mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-06 03:02:37 +02:00
Merge #15474: rest/rpc: Make mempoolinfo atomic
e377846ff1 rest/rpc: Make mempoolinfo atomic (João Barbosa)
Pull request description:
Make `/rest/mempool/info.json` endpoint and `getmempoolinfo` RPC atomic.
ACKs for commit e37784:
Tree-SHA512: 6b40844df813e180d68731fc263bd9a2c2a01fe143a4f5a8974e3e0023e6e2e1e9bc46669ddfdf44f0e47142feda2a2aad1ea02ef8837081e11522347f314b0b
This commit is contained in:
@@ -1487,6 +1487,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