-
Notifications
You must be signed in to change notification settings - Fork 107
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
feat(state): add transparent address indexes to the non-finalized state #4022
Conversation
31abad2
to
62e1fc1
Compare
There's something wrong with the balance calculations in this PR:
|
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 keep reviewing this PR but I can't seem to find the bug 😞 (or any other issue). I'll leave it for someone else to review.
3c48d5f
to
7cb552f
Compare
I think it's probably a mismatch between the created and spent UTXOs. Probably some missing spent UTXOs, because it's an overflow. I'll make this part of the code easier to get right. |
7cb552f
to
207d3fd
Compare
0031529
to
8f6a9b0
Compare
@Mergifyio update |
✅ Branch has been successfully updated |
@Mergifyio update |
✅ Branch has been successfully updated |
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.
Re-approving.
Motivation
As part of the address index RPCs, we need to track address balances, UTXOs, and transactions in the non-finalized state.
This PR creates the address indexes in the non-finalized state, but it doesn't connect them to state requests or RPCs yet.
Specifications
See tickets:
Designs
The
TransparentTransfers
struct holds the address indexes for a single address.Index updates use
UpdateWith<T> for TransparentTransfers
, whereT
is a tuple of arguments for:Spent UTXOs are a bit tricky, because we need to add their values to the
ContextuallyValidBlock
.Solution
TransparentTransfers
address index typeRelated changes:
ContextuallyValidBlock
TransactionLocation
s as part of merging PR 3. change(db): Store UTXOs by transaction location rather than transaction hash #3978Related bug fixes:
Previously, the chain code was indexing each transparent output in the block multiple times (once per transaction). Because we were using
HashMap
s for chain indexes, this bug did not cause any problems. But in the address indexes, it made balances overflow.(This should also improve non-finalized state performance for large blocks.)
Review
@conradoplg reviewed a draft of this PR.
We still need to connect these indexes to state requests, but the changes in this PR are enough to get us started.
Reviewer Checklist
Follow Up Work
In other PRs: