aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@gmail.com>2019-07-24 13:39:42 -0400
committerJames O'Beirne <james.obeirne@gmail.com>2019-08-15 11:19:40 -0400
commit582d2cd74754d6b9a2394616a9c82a89d2d71976 (patch)
tree6aca21d9b8481b465a74811fb9c2b97ddc9576c4 /src/init.cpp
parent569353068568444a25b301bbd6513bb510157dc9 (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/init.cpp')
-rw-r--r--src/init.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 50ae0c6252..97be4637a6 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -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