Only schedule mainchain RPC checks after initial check succeeds

This commit is contained in:
Gregory Sanders 2019-05-06 09:38:58 -04:00
parent bb80fd1602
commit 9d4097dca2

View file

@ -1866,11 +1866,6 @@ bool AppInitMain()
SetRPCWarmupFinished();
// ELEMENTS:
CScheduler::Function f2 = boost::bind(&MainchainRPCCheck, false);
unsigned int check_rpc_every = gArgs.GetArg("-recheckpeginblockinterval", 120);
if (check_rpc_every) {
scheduler.scheduleEvery(f2, check_rpc_every);
}
uiInterface.InitMessage(_("Awaiting mainchain RPC warmup"));
if (!MainchainRPCCheck(true)) { //Initial check, fail immediately
return InitError(_("ERROR: elementsd is set to verify pegins but cannot get valid response from the mainchain daemon. Please check debug.log for more information.")
@ -1878,6 +1873,12 @@ 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"));
}
CScheduler::Function f2 = boost::bind(&MainchainRPCCheck, false);
unsigned int check_rpc_every = gArgs.GetArg("-recheckpeginblockinterval", 120);
if (check_rpc_every) {
scheduler.scheduleEvery(f2, check_rpc_every);
}
uiInterface.InitMessage(_("Done loading"));
g_wallet_init_interface.Start(scheduler);