Skip to content

Commit

Permalink
Merge ElementsProject#647: Move MainchainRPCCheck to its own schedule…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
stevenroose committed Jun 5, 2019
2 parents 335be01 + a502bc8 commit 94c7644
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ static std::unique_ptr<ECCVerifyHandle> globalVerifyHandle;

static boost::thread_group threadGroup;
static CScheduler scheduler;
static CScheduler reverification_scheduler;

void Interrupt()
{
Expand Down Expand Up @@ -1960,10 +1961,14 @@ bool AppInitMain(InitInterfaces& interfaces)
+ 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"));
}

// Start the lightweight block re-evaluation scheduler thread
CScheduler::Function reevaluationLoop = std::bind(&CScheduler::serviceQueue, &reverification_scheduler);
threadGroup.create_thread(std::bind(&TraceThread<CScheduler::Function>, "reevaluation_scheduler", reevaluationLoop));

CScheduler::Function f2 = boost::bind(&MainchainRPCCheck, false);
unsigned int check_rpc_every = gArgs.GetArg("-recheckpeginblockinterval", 120);
unsigned int check_rpc_every = gArgs.GetArg("-recheckpeginblockinterval", 120) * 1000;
if (check_rpc_every) {
scheduler.scheduleEvery(f2, check_rpc_every);
reverification_scheduler.scheduleEvery(f2, check_rpc_every);
}

uiInterface.InitMessage(_("Done loading"));
Expand Down

0 comments on commit 94c7644

Please sign in to comment.