aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-05-06 16:58:53 +0200
committerMacroFake <falke.marco@gmail.com>2022-08-16 17:26:40 +0200
commitfac04cb6ba1d032587bd02eab2247fd655a548cd (patch)
treebe6149a2a37ee881bccb119e08a1260a237d4a99 /src/init.cpp
parentfac15ff673f0d6f84ea1eaae855597da02b0e510 (diff)
downloadbitcoin-fac04cb6ba1d032587bd02eab2247fd655a548cd.tar.xz
refactor: Add lock annotations to Active* methods
This is a refactor, putting the burden to think about thread safety to the caller. Otherwise, there is a risk that the caller will assume thread safety where none exists, as is evident in the previous two commits.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index d48337db08..488c754e95 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1547,7 +1547,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// Either install a handler to notify us when genesis activates, or set fHaveGenesis directly.
// No locking, as this happens before any background thread is started.
boost::signals2::connection block_notify_genesis_wait_connection;
- if (chainman.ActiveChain().Tip() == nullptr) {
+ if (WITH_LOCK(chainman.GetMutex(), return chainman.ActiveChain().Tip() == nullptr)) {
block_notify_genesis_wait_connection = uiInterface.NotifyBlockTip_connect(std::bind(BlockNotifyGenesisWait, std::placeholders::_2));
} else {
fHaveGenesis = true;