-
Notifications
You must be signed in to change notification settings - Fork 137
garbage collect zero-value UTXOs #1832
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: 0-8-0-staging
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 19245969484Details
💛 - Coveralls |
f3a3bff to
f55b6c5
Compare
3bd769d to
6fe11a5
Compare
a8f3ce4 to
afbfebf
Compare
bf3e3ee to
d812a8e
Compare
d812a8e to
0ceaf76
Compare
5635183 to
0b60ce3
Compare
|
I like |
ef93717 to
d9383ba
Compare
GeorgeTsagk
left a comment
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.
last nits, 99% there
d9383ba to
773c448
Compare
GeorgeTsagk
left a comment
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.
LGTM
773c448 to
4fb0135
Compare
|
@ffranr: review reminder |
| assetsAtAnchor, err := a.queryChainAssets( | ||
| ctx, q, QueryAssetFilters{ | ||
| AnchorPoint: u.Outpoint, | ||
| Now: sql.NullTime{ | ||
| Time: now, | ||
| Valid: true, | ||
| }, | ||
| }, | ||
| ) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to query assets at "+ | ||
| "anchor: %w", err) | ||
| } |
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.
Something for your consideration:
I’ve found that wrapping errors like this is usually enough:
fmt.Errorf("query chain assets at anchor: %w", err)
Since it will appear inside a higher level error anyway, adding “failed to” doesn’t add much in my view.
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 agree we should reduce verbosity as much as possible but I don't feel comfortable breaking the pattern of the rest of the codebase (we seem to use everywhere one of these):
unable to ...error...failed to ...
Happy to work on a PR to reduce verbosity globally at some point.
59a118d to
1cf422a
Compare
This includes the addition of a "swept" field in the "managed_utxos" table with the corresponding migration and the "MarkManagedUTXOAsSwept" function.
…ng family and index
1cf422a to
66faf3f
Compare
Garbage collect the residue orphaned UTXOs when creating transactions. Orphaned UTXOs occur when creating tombstones or full burns.
Currently, these UTXOs accumulate in the DB and are never cleaned. This PR introduces a garbage collection mechanism to collect these UTXOs and use them as inputs of transactions initiated by
tapd:The PR adds a new
sweptflag to themanaged_utxotable because UTXOs are not removed from the table when spent. This flag is also returned by theListUtxosRPC endpoint.The mechanism preserves the liveness and safety properties, ensuring that zero-value UTXOs can never accumulate in the DB. Adding garbage collection to Mint transactions is not necessary to ensure these properties.
Fixes #514
Note to reviewers
unspent, keeping the spent outputs in a table calledmanage_utxosseems like a contradiction, same logic applies for the need of asweptflag in that table. We should either rename the table or store spent utxos somewhere else?