You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #1022: When validation is waiting for parent chain daemon, "stall".
e5ba4e8 Regression test for pegin validation issues during sync (Glenn Willen)
7f79f72 Finish removing 'recheckpeginblockinterval'; move MainchainRPCCheck (Glenn Willen)
4ba4e07 When validation is waiting for parent chain daemon, "stall". (Glenn Willen)
Pull request description:
Currently, if -validatepegin is given, and block validation can't proceed
because the parent chain is not synced, we mark the block invalid and put
it in a queue to be "revalidated" later. Unfortunately, marking a block
invalid has downstream consequences, in particular causing descendant blocks
to be marked invalid, which are not currently fixed by the queue.
Instead, we'll use a different strategy: if the mainchain daemon isn't
sufficiently synced to validate a block, we will "stall" connecting that
block to the chain, and have ActivateBestChain simply keep the tip at the
previous block until we're ready.
We can still download and validate (partly) blocks past this point while
we're waiting. They will be connected once the parent chain daemon catches
up.
Top commit has no ACKs.
Tree-SHA512: 0aa8d22460af062509f431e0f742297733d0e20b3fc1babca35f25a07c5243c7665dd0ba5fb439e3782c842a264dacd14cee6da49f8df3d1a26f5391c4742538
Copy file name to clipboardExpand all lines: src/init.cpp
+80-21Lines changed: 80 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -582,7 +582,6 @@ void SetupServerArgs()
582
582
gArgs.AddArg("-mainchainrpccookiefile=<file>", "The bitcoind cookie auth path which the daemon will use to connect to the trusted mainchain daemon to validate peg-ins. (default: `<datadir>/regtest/.cookie`)", false, OptionsCategory::ELEMENTS);
583
583
gArgs.AddArg("-mainchainrpctimeout=<n>", strprintf("Timeout in seconds during mainchain RPC requests, or 0 for no timeout. (default: %d)", DEFAULT_HTTP_CLIENT_TIMEOUT), false, OptionsCategory::ELEMENTS);
584
584
gArgs.AddArg("-peginconfirmationdepth=<n>", strprintf("Pegin claims must be this deep to be considered valid. (default: %d)", DEFAULT_PEGIN_CONFIRMATION_DEPTH), false, OptionsCategory::ELEMENTS);
585
-
gArgs.AddArg("-recheckpeginblockinterval=<n>", strprintf("The interval in seconds at which a peg-in witness failing block is re-evaluated in case of intermittent peg-in witness failure. 0 means never. (default: %u)", 120), false, OptionsCategory::ELEMENTS);
586
585
gArgs.AddArg("-parentpubkeyprefix", strprintf("The byte prefix, in decimal, of the parent chain's base58 pubkey address. (default: %d)", 111), false, OptionsCategory::CHAINPARAMS);
587
586
gArgs.AddArg("-parentscriptprefix", strprintf("The byte prefix, in decimal, of the parent chain's base58 script address. (default: %d)", 196), false, OptionsCategory::CHAINPARAMS);
588
587
gArgs.AddArg("-parent_bech32_hrp", strprintf("The human-readable part of the parent chain's bech32 encoding. (default: %s)", "bc"), false, OptionsCategory::CHAINPARAMS);
if (!MainchainRPCCheck(true)) { //Initial check only
1884
-
const std::string err_msg = "ERROR: elements is set to verify pegins but cannot get valid response from the mainchain daemon. Please check debug.log for more information.\n\nIf you haven't setup a bitcoind please get the latest stable version from https://bitcoincore.org/en/download/ or if you do not need to validate pegins set in your elements configuration validatepegin=0";
1885
-
// We fail immediately if this node has RPC server enabled
1886
-
if (gArgs.GetBoolArg("-server", false)) {
1887
-
InitError(err_msg);
1888
-
returnfalse;
1889
-
} else {
1890
-
// Or gently warn the user, and continue
1891
-
InitWarning(err_msg);
1892
-
gArgs.SoftSetArg("-validatepegin", "0");
1936
+
if (!MainchainRPCCheck()) {
1937
+
const std::string err_msg = "ERROR: elements is set to verify pegins but cannot get valid response from the mainchain daemon. Please check debug.log for more information.\n\nIf you haven't setup a bitcoind please get the latest stable version from https://bitcoincore.org/en/download/ or if you do not need to validate pegins set in your elements configuration validatepegin=0";
1938
+
// We fail immediately if this node has RPC server enabled
1939
+
if(gArgs.GetBoolArg("-server", false)) {
1940
+
InitError(err_msg);
1941
+
returnfalse;
1942
+
} else {
1943
+
// Or gently warn the user, and continue
1944
+
InitWarning(err_msg);
1945
+
gArgs.SoftSetArg("-validatepegin", "0");
1946
+
}
1893
1947
}
1894
1948
}
1895
1949
1896
-
// Start the lightweight block re-evaluation scheduler thread
0 commit comments