feat(wallet): add functions to lock and unlock utxos #1669
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
fixes #849
Add functions to Wallet to lock and unlock utxos. The locked TxOuts are automatically added to TxBuilder's "unspendable" list. This is just a draft to see if this approach makes sense, if so then I'll add persisting the locked utxos.
TODO
locked_unspent
andunlocked_unspent
toWallet::Changeset
Wallet.locked_unspent
list afterWallet::apply_update
and remove locked spent UTXOslocked_unspent
dataNotes to the reviewers
The design is based on how the core wallet locks UTXOs except I think it's simpler to always persist locked utxos. See: https://bitcoincore.org/en/doc/28.0.0/rpc/wallet/lockunspent/
Should locked UTXOs that are found to be spent be removed from the locked list after only one confirmation?
If API looks good then it won't be a breaking change so I propose this PR goes into the 1.1 milestone.
Changelog notice
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features: