-
Notifications
You must be signed in to change notification settings - Fork 37.7k
validation: invalid block handling followups #32843
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
base: master
Are you sure you want to change the base?
validation: invalid block handling followups #32843
Conversation
In InvalidateBlock, both the block failure flags and m_best_header are kept up to date with each block that is disconnected, so it's not necessary to recalculate them at the end of this function.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32843. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
It is not true in general that all blocks with the same work (as defined via nChainWork) as the tip are candidates expected to be in setBlockIndexCandidates - only ones with a better tiebreak than the tip. Make that clear in various spots. Also explain that we don't use CBlockIndexWorkComparator tiebreak rules for m_best_header.
ad6cdc8
to
e32e720
Compare
maybe I'm missing something but even without the
|
Yes, that's true, good point! To phrase it in my words, the condition that checks whether I guess that means we could, instead of |
yes sounds good! (whenever you retouch next) Ah missed the fact that iteration of entire block index is done in |
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.
ACK e32e720.
Some follow-ups from #31405:
m_best_header
inInvalidateBlock()
, which already does the accounting for these quantities while disconnecting blocks, so recalcuation is not needed in the finalInvalidChainFound
call (validation: stricter internal handling of invalid blocks #31405 (comment))CBlockIndexWorkComparator
score at least as good as the tip (and no others) are expected insetBlockIndexCandidates
.People think of
nChainWork
when the termwork
is used and not of the (slightly arbitrary)CBlockIndexWorkComparator
tiebreaker rules, which makes the current documentation imprecise ( validation: stricter internal handling of invalid blocks #31405 (comment) )nChainWork
, notCBlockIndexWorkComparator
is used form_best_header
(validation: stricter internal handling of invalid blocks #31405 (comment))