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:
MarcoFalke 2019-04-17 10:30:32 -04:00
commit e2b5fdee00
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25

View file

@ -1487,6 +1487,8 @@ static UniValue getchaintips(const JSONRPCRequest& request)
UniValue MempoolInfoToJSON(const CTxMemPool& pool)
{
// Make sure this call is atomic in the pool.
LOCK(pool.cs);
UniValue ret(UniValue::VOBJ);
ret.pushKV("size", (int64_t)pool.size());
ret.pushKV("bytes", (int64_t)pool.GetTotalTxSize());