Resolve a race condition on `chainActive.Tip()` in initialization (introduced in #4379).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
82e641f3cc
commit
74467f8f02
15
src/init.cpp
15
src/init.cpp
|
@ -1563,10 +1563,17 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
// original value of chainActive.Tip(), which corresponds with the wallet's
|
||||
// view of the chaintip, is passed to ThreadNotifyWallets before the chain
|
||||
// tip changes again.
|
||||
boost::function<void()> threadnotifywallets = boost::bind(&ThreadNotifyWallets, chainActive.Tip());
|
||||
threadGroup.create_thread(
|
||||
boost::bind(&TraceThread<boost::function<void()>>, "txnotify", threadnotifywallets)
|
||||
);
|
||||
{
|
||||
CBlockIndex *pindexLastTip;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
pindexLastTip = chainActive.Tip();
|
||||
}
|
||||
boost::function<void()> threadnotifywallets = boost::bind(&ThreadNotifyWallets, pindexLastTip);
|
||||
threadGroup.create_thread(
|
||||
boost::bind(&TraceThread<boost::function<void()>>, "txnotify", threadnotifywallets)
|
||||
);
|
||||
}
|
||||
|
||||
// ********************************************************* Step 9: data directory maintenance
|
||||
|
||||
|
|
Loading…
Reference in New Issue