Skip to content

Commit

Permalink
Merge #650: [0.17 backport] Move MainchainRPCCheck to its own schedul…
Browse files Browse the repository at this point in the history
…e 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
  • Loading branch information
instagibbs committed Jun 6, 2019
2 parents 58c070a + 78e315d commit 81674d6
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 @@ -146,6 +146,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 @@ -1873,10 +1874,14 @@ bool AppInitMain()
+ 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 81674d6

Please sign in to comment.