mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +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:
commit
e2b5fdee00
1 changed files with 2 additions and 0 deletions
|
|
@ -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());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue