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>
This commit is contained in:
James O'Beirne
2019-07-24 13:39:42 -04:00
parent 5693530685
commit 582d2cd747
4 changed files with 22 additions and 14 deletions

View File

@@ -235,8 +235,11 @@ void Shutdown(InitInterfaces& interfaces)
//
// g_chainstate is referenced here directly (instead of ::ChainstateActive()) because it
// may not have been initialized yet.
if (g_chainstate && g_chainstate->CanFlushToDisk()) {
g_chainstate->ForceFlushStateToDisk();
{
LOCK(cs_main);
if (g_chainstate && g_chainstate->CanFlushToDisk()) {
g_chainstate->ForceFlushStateToDisk();
}
}
// After there are no more peers/RPC left to give us new data which may generate