-
Notifications
You must be signed in to change notification settings - Fork 825
Clean up UTXOs #1376
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
Clean up UTXOs #1376
Conversation
vms/avm/states/state.go
Outdated
| return txIDs, nil | ||
| } | ||
|
|
||
| func (s *state) RemoveRejectedTxs() error { |
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.
What we need to do in this PR:
- All statuses should be removed from the database. This includes Accepted, Rejected, and Processing statuses.
- All transactions with statuses Rejected or Processing must be removed from the database.
- All transactions with status Accepted must have all the UTXOs consumed removed from the database.
- Depending on the performance - we may need to batch these operations and perform them in the background.
|
|
||
| func (s *state) rejectedTxs() ([]ids.ID, error) { | ||
| var txIDs []ids.ID | ||
| iter := s.statusDB.NewIterator() |
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.
creating an iterator pins a database version on disk all iterators must be Released.
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.
updated
vms/avm/states/state.go
Outdated
| return err | ||
| } | ||
| // find UTXOID produced by the tx | ||
| utxos := tx.UTXOs() |
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 should not be touching produced UTXOs.
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.
updated
41824d2 to
fa296bd
Compare
Why this should be merged
How this works
How this was tested