-
Notifications
You must be signed in to change notification settings - Fork 106
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
Implement UTXO set in zebra-state
Service
#724
Comments
Just a reminder: transactions in a block are verified based on the UTXO set of the parent block. So the UTXO state must be per-block (not per-chain or global). |
Actually, you could add a new chain from prior parent block couldn't you, in which case you would still need the old UTXO set still. Okay, I think I'm getting there on this one. @teor2345 we only need to save to disk the UTXO set of the tip of the chain that we've persisted to disk right? My tenative plan for this is to just use Now that I think about it I should possibly write the chain reorg and multiple chain tracking logic for |
blocked by #452 |
Design per our discussions after the workshop today
|
What you need is a partially persistent set or map. I wish that was the way we did it in zcashd, rather than treating it as a caching problem. (Cache invalidation is one of the "two hard problems in computer science", whereas it's comparatively easy to view it as a persistent data structure.) In any case, relying on the reorg limit is a nice simplification for the on-disk representation. |
@daira the |
This design is covered somewhat in #902 |
"In terms of what treestate we need, we 'just' need the anchor, as the nullifier set is just a set we maintain." |
We've implemented the UTXO set in the state service. |
As a per-requisite for script verification we need to be able to grab the amount and scriptPubKey of transactions that are being verified. These inputs must come from the pool of unspent transactions rather than from inputs stored in the
Transaction
itself.Tracking of these unspent transactions should be owned by the state service. The idea being that once
zebra-consensus
has validated a transaction and added it to the chain state we should apply the changes contained in the newly added transaction to the utxo set. Any money that was spent in the newly added transaction should be removed from the UTXO set and replaced with the unspent outputs of the transaction.The text was updated successfully, but these errors were encountered: