Port PR93 from @denioD
This commit is contained in:
31
src/init.cpp
31
src/init.cpp
@@ -736,22 +736,6 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
||||
}
|
||||
}
|
||||
|
||||
void ThreadNotifyRecentlyAdded()
|
||||
{
|
||||
while (true) {
|
||||
// Run the notifier on an integer second in the steady clock.
|
||||
auto now = std::chrono::steady_clock::now().time_since_epoch();
|
||||
auto nextFire = std::chrono::duration_cast<std::chrono::seconds>(
|
||||
now + std::chrono::seconds(1));
|
||||
std::this_thread::sleep_until(
|
||||
std::chrono::time_point<std::chrono::steady_clock>(nextFire));
|
||||
|
||||
boost::this_thread::interruption_point();
|
||||
|
||||
mempool.NotifyRecentlyAdded();
|
||||
}
|
||||
}
|
||||
|
||||
/** Sanity checks
|
||||
* Ensure that Hush is running in a usable environment with all
|
||||
* necessary library support.
|
||||
@@ -2088,6 +2072,17 @@ 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. We perform this before step 10 (import blocks) so that the
|
||||
// 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)
|
||||
);
|
||||
|
||||
// ********************************************************* Step 9: data directory maintenance
|
||||
|
||||
// if pruning, unset the service bit and perform the initial blockstore prune
|
||||
@@ -2155,10 +2150,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.
|
||||
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "txnotify", &ThreadNotifyRecentlyAdded));
|
||||
|
||||
if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))
|
||||
StartTorControl(threadGroup, scheduler);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user