-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[forward port] When validation is waiting for parent chain daemon, "stall" #1030
[forward port] When validation is waiting for parent chain daemon, "stall" #1030
Conversation
fdf47da
to
3549b8f
Compare
Blocked on fix to #1022. |
3549b8f
to
da11d7b
Compare
src/rpc/rawtransaction_util.cpp
Outdated
CHECK_NONFATAL(err == "Needs more confirmations."); | ||
bool depth_failed = false; | ||
if(txin.m_is_pegin && !IsValidPeginWitness(mtx.witness.vtxinwit[i].m_pegin_witness, fedpegscripts, txin.prevout, err, true, &depth_failed)) { | ||
assert(depth_failed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check (the string error version) changed from assert
to CHECK_NONFATAL
since 0.18, apparently. I can't tell whether you changed it back to assert intentionally when rebasing my changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did consciously change this to an assert
, though I didn't think much about the code history. Let me change it back because I don't remember my reasoning.
src/init.cpp
Outdated
// Or gently warn the user, and continue | ||
InitError(Untranslated(err_msg)); | ||
gArgs.SoftSetArg("-validatepegin", "0"); | ||
if (!MainchainRPCCheck()) { //Initial check only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having trouble reading the range-diff
here, but I think you might have removed this (now outdated) comment yourself when rebasing my original PR, and then failed to carry that over to this PR.
utACK da11d7b. I ran:
and checked that this appeared to be a faithful rebase of my work, which it is, subject to comments above (which are all nits.) (It turns out that |
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.
- Finish removing all references to 'recheckpeginblockinterval', including documentation and tests. - Remove periodic calls to MainchainRPCCheck; use it only at startup (and refactor accordingly to simplify logic.) - Move MainchainRPCCheck from validation.h/cpp (public) to an internal helper function of init.cpp. - Comment out definition of 'revalidation queue' type in txdb, to suppress "unused variable" warning. (Leave it visible to avoid future reuse.)
Add a regression test for ElementsProject#891 . This checks that we can sync successfully when making a bunch of new blocks just as we have transient loss of parent daemon connectivity. This reliably fails without the fix, and reliably succeeds with it. (It stands in for the situation, more common in production, where we sync faster than the parent daemon can keep up after a long outage.)
da11d7b
to
b2e1cc3
Compare
utACK b2e1cc3, verified that it contains only the requested changes from da11d7b.
|
Forward-port of #1022