diff options
author | James O'Beirne <james.obeirne@gmail.com> | 2019-07-24 13:39:42 -0400 |
---|---|---|
committer | James O'Beirne <james.obeirne@gmail.com> | 2019-08-15 11:19:40 -0400 |
commit | 582d2cd74754d6b9a2394616a9c82a89d2d71976 (patch) | |
tree | 6aca21d9b8481b465a74811fb9c2b97ddc9576c4 /src/rpc/blockchain.cpp | |
parent | 569353068568444a25b301bbd6513bb510157dc9 (diff) |
Cover UTXO set access with lock annotations
i.e. any CoinsViews members. Adds a lock acquisition to `gettxoutsetinfo` RPC
to comply with added annotations.
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r-- | src/rpc/blockchain.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 8061939a26..e3d5394a2c 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1062,7 +1062,9 @@ static UniValue gettxoutsetinfo(const JSONRPCRequest& request) CCoinsStats stats; ::ChainstateActive().ForceFlushStateToDisk(); - if (GetUTXOStats(&::ChainstateActive().CoinsDB(), stats)) { + + CCoinsView* coins_view = WITH_LOCK(cs_main, return &ChainstateActive().CoinsDB()); + if (GetUTXOStats(coins_view, stats)) { ret.pushKV("height", (int64_t)stats.nHeight); ret.pushKV("bestblock", stats.hashBlock.GetHex()); ret.pushKV("transactions", (int64_t)stats.nTransactions); |