Initialize ThreadNotifyWallets before additional blocks are imported.
Co-authored-by: Daira Hopwood <daira@electriccoin.co>
This commit is contained in:
parent
77c2e1c251
commit
faca79eb2f
13
src/init.cpp
13
src/init.cpp
|
@ -1545,6 +1545,15 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
}
|
||||
#endif // ENABLE_MINING
|
||||
|
||||
// Start the thread that notifies listeners of transactions that have been
|
||||
// recently added to the mempool, or have been added to or removed from the
|
||||
// chain.
|
||||
|
||||
boost::function<void()> threadnotifywallets = boost::bind(&ThreadNotifyWallets, chainActive.Tip());
|
||||
threadGroup.create_thread(
|
||||
boost::bind(&TraceThread<boost::function<void()>>, "txnotify", threadnotifywallets)
|
||||
);
|
||||
|
||||
// ********************************************************* Step 9: data directory maintenance
|
||||
|
||||
// if pruning, unset the service bit and perform the initial blockstore prune
|
||||
|
@ -1599,10 +1608,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0);
|
||||
#endif
|
||||
|
||||
// Start the thread that notifies listeners of transactions that have been
|
||||
// recently added to the mempool, or have been added to or removed from the
|
||||
// chain.
|
||||
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "txnotify", &ThreadNotifyWallets));
|
||||
|
||||
if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))
|
||||
StartTorControl(threadGroup, scheduler);
|
||||
|
|
|
@ -81,13 +81,9 @@ struct CachedBlockData {
|
|||
pindex(pindex), oldTrees(oldTrees), txConflicted(txConflicted) {}
|
||||
};
|
||||
|
||||
void ThreadNotifyWallets()
|
||||
void ThreadNotifyWallets(CBlockIndex *pindexLastTip)
|
||||
{
|
||||
CBlockIndex *pindexLastTip = nullptr;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
pindexLastTip = chainActive.Tip();
|
||||
}
|
||||
assert(pindexLastTip != nullptr);
|
||||
|
||||
while (true) {
|
||||
// Run the notifier on an integer second in the steady clock.
|
||||
|
|
|
@ -74,6 +74,6 @@ struct CMainSignals {
|
|||
|
||||
CMainSignals& GetMainSignals();
|
||||
|
||||
void ThreadNotifyWallets();
|
||||
void ThreadNotifyWallets(CBlockIndex *pindexLastTip);
|
||||
|
||||
#endif // BITCOIN_VALIDATIONINTERFACE_H
|
||||
|
|
Loading…
Reference in New Issue