-
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 19575345571Details
💛 - Coveralls |
f3a3bff to
f55b6c5
Compare
3bd769d to
6fe11a5
Compare
a8f3ce4 to
afbfebf
Compare
bf3e3ee to
d812a8e
Compare
d812a8e to
0ceaf76
Compare
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
1cf422a to
66faf3f
Compare
2b3ac4f to
035a840
Compare
66faf3f to
61a19e9
Compare
|
@ffranr: review reminder |
ffranr
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.
I think we should double check our logic around coin release but otherwise just nits.
| LeaseExpiry: sql.NullTime{ | ||
| Time: finalLeaseExpiry.UTC(), | ||
| Valid: true, | ||
| }, |
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.
Could be a helper like sqlInt16
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.
no such thing as a sqlTime. I could add one but then I'll have to change everywhere sql.NullTime is used.
| // Send full amount of the new asset. This should sweep Alice's | ||
| // first tombstone and create a new one. | ||
| bobAddr2, err := secondTapd.NewAddr(ctxb, &taprpc.NewAddrRequest{ | ||
| AssetId: genInfo2.AssetId, | ||
| Amt: assetAmount, | ||
| AssetVersion: rpcAssets2[0].Version, | ||
| }) | ||
| require.NoError(t.t, err) | ||
|
|
||
| sendResp2, _ := sendAssetsToAddr(t, t.tapd, bobAddr2) | ||
|
|
||
| ConfirmAndAssertOutboundTransfer( | ||
| t.t, t.lndHarness.Miner().Client, t.tapd, sendResp2, | ||
| genInfo2.AssetId, | ||
| []uint64{0, assetAmount}, 1, 2, | ||
| ) | ||
| AssertNonInteractiveRecvComplete(t.t, secondTapd, 2) |
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.
Maybe we can inspect this transaction to ensure that the additional zero-value tombstone input is present.
| require.NoError(t, err) | ||
|
|
||
| transferResp, err := sender.ListTransfers( | ||
| ctxb, &taprpc.ListTransfersRequest{}, | ||
| ) | ||
| require.NoError(t, err) | ||
|
|
||
| transferRespJSON, err := formatProtoJSON(transferResp) | ||
| require.NoError(t, err) | ||
| t.Logf("Got response from list transfers: %v", transferRespJSON) |
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.
Why remove these lines? That doesn't seem to fix under the commit subject. Same further above also.
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.
Do you mean that I shouldn't remove these logs in this PR or that I should move them to a separate commit?
Why remove these lines?
They're only there to dump the entirety of the responses into the console, which serves no purpose (we should use require to validate assertions).
I've been particularly annoyed by these logs so I try to remove them when I can. Happy to revert or create a dedicated PR.
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
61a19e9 to
b45eb88
Compare
b45eb88 to
a686922
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?