-
Notifications
You must be signed in to change notification settings - Fork 135
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
Fetch by Index + Orphan Race Fix #213
Fetch by Index + Orphan Race Fix #213
Conversation
Pull Request Test Coverage Report for Build 10287
💛 - Coveralls |
@patrick-ogrady looks like there are some failing tests 🤔 |
Yep! Sorry this is still WIP in-progress @qiwu7. Was planning a lightweight PR and then decided it was a good opportunity to clean up some other potential races. |
// If this is the case, we continue reconciling. | ||
canonical, canonicalErr := r.helper.CanonicalBlock(ctx, lookupBlock) | ||
if canonicalErr != nil { | ||
if err != nil { |
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.
We no longer expect this to error in the case of a re-org, so we don't need custom handling. CompareBalance
can handle the case where a non-canonical block is returned by this call.
166a762
to
003d728
Compare
This PR changes
utils.CurrencyBalance
to fetch by index instead of by hash. This fixes an issue where thereconciler
requests balances of orphaned blocks (by hash) when processing reconciliations near tip. This PR also addresses a potential race condition where a reorg occurs while comparing balance.Changelog
utils.CurrencyBalance
to only lookup historical balances by index (up to the caller to determine if canonical)reconciler.AccountCurrency
totypes.AccountCurrency
(storage
should not be depending onreconciler
)ReconcilerHelper
interface to be more transparent about guarantees