Skip to content

Commit 94c7644

Browse files
committed
Merge ElementsProject#647: Move MainchainRPCCheck to its own schedule to avoid waiting for itself
a502bc8 Move MainchainRPCCheck to its own schedule, fix resolution (Gregory Sanders) Pull request description: Also fix second->millisecond regression from 0.17 Tree-SHA512: 8074d953f6a661ce5cab76d0304d85acea0b7eabfcf9dc5be6c3bba1a34caf03649fa3feb6d20ab0e546640d98a016d3ddb12f8176b7fefbe772323d3c870de2
2 parents 335be01 + a502bc8 commit 94c7644

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/init.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ static std::unique_ptr<ECCVerifyHandle> globalVerifyHandle;
179179

180180
static boost::thread_group threadGroup;
181181
static CScheduler scheduler;
182+
static CScheduler reverification_scheduler;
182183

183184
void Interrupt()
184185
{
@@ -1960,10 +1961,14 @@ bool AppInitMain(InitInterfaces& interfaces)
19601961
+ strprintf(_("If you haven't setup a %s please get the latest stable version from %s or if you do not need to validate pegins set in your elements configuration %s"), "bitcoind", "https://bitcoincore.org/en/download/", "validatepegin=0"));
19611962
}
19621963

1964+
// Start the lightweight block re-evaluation scheduler thread
1965+
CScheduler::Function reevaluationLoop = std::bind(&CScheduler::serviceQueue, &reverification_scheduler);
1966+
threadGroup.create_thread(std::bind(&TraceThread<CScheduler::Function>, "reevaluation_scheduler", reevaluationLoop));
1967+
19631968
CScheduler::Function f2 = boost::bind(&MainchainRPCCheck, false);
1964-
unsigned int check_rpc_every = gArgs.GetArg("-recheckpeginblockinterval", 120);
1969+
unsigned int check_rpc_every = gArgs.GetArg("-recheckpeginblockinterval", 120) * 1000;
19651970
if (check_rpc_every) {
1966-
scheduler.scheduleEvery(f2, check_rpc_every);
1971+
reverification_scheduler.scheduleEvery(f2, check_rpc_every);
19671972
}
19681973

19691974
uiInterface.InitMessage(_("Done loading"));

0 commit comments

Comments
 (0)