Skip to content

Commit 81674d6

Browse files
committed
Merge #650: [0.17 backport] Move MainchainRPCCheck to its own schedule to avoid waiting for itself
78e315d Move MainchainRPCCheck to its own schedule, fix resolution (Gregory Sanders) Pull request description: backport of #647 for 0.17 Tree-SHA512: 48bba6d29048c9686aa2a122156e6321a1da1e900d301a8898f4942da076fadc2cb9d29f14622b3c0a6562f7bda3e7a6764c79fdfc0bdbfb272b2041e1124032
2 parents 58c070a + 78e315d commit 81674d6

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
@@ -146,6 +146,7 @@ static std::unique_ptr<ECCVerifyHandle> globalVerifyHandle;
146146

147147
static boost::thread_group threadGroup;
148148
static CScheduler scheduler;
149+
static CScheduler reverification_scheduler;
149150

150151
void Interrupt()
151152
{
@@ -1873,10 +1874,14 @@ bool AppInitMain()
18731874
+ 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"));
18741875
}
18751876

1877+
// Start the lightweight block re-evaluation scheduler thread
1878+
CScheduler::Function reevaluationLoop = std::bind(&CScheduler::serviceQueue, &reverification_scheduler);
1879+
threadGroup.create_thread(std::bind(&TraceThread<CScheduler::Function>, "reevaluation_scheduler", reevaluationLoop));
1880+
18761881
CScheduler::Function f2 = boost::bind(&MainchainRPCCheck, false);
1877-
unsigned int check_rpc_every = gArgs.GetArg("-recheckpeginblockinterval", 120);
1882+
unsigned int check_rpc_every = gArgs.GetArg("-recheckpeginblockinterval", 120) * 1000;
18781883
if (check_rpc_every) {
1879-
scheduler.scheduleEvery(f2, check_rpc_every);
1884+
reverification_scheduler.scheduleEvery(f2, check_rpc_every);
18801885
}
18811886

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

0 commit comments

Comments
 (0)