Rename cancel_tx to unreserve_change_address#326
Rename cancel_tx to unreserve_change_address#326GideonBature wants to merge 1 commit intobitcoindevkit:masterfrom
Conversation
e5b8d34 to
3f7ff2d
Compare
Pull Request Test Coverage Report for Build 18323393969Details
💛 - Coveralls |
|
@GideonBature can you reword the commit as |
|
Noted @luisschwab let me do that now. |
3f7ff2d to
35faa29
Compare
|
This recent push reword the commit message. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #326 +/- ##
=========================================
Coverage ? 85.24%
=========================================
Files ? 23
Lines ? 8229
Branches ? 0
=========================================
Hits ? 7015
Misses ? 1214
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| /// This frees up the change address used when creating the tx for use in future transactions. | ||
| // TODO: Make this free up reserved utxos when that's implemented | ||
| pub fn cancel_tx(&mut self, tx: &Transaction) { | ||
| pub fn unreserve_change_address(&mut self, tx: &Transaction) { |
There was a problem hiding this comment.
Hm, ok but it doesn't only unreserve the change address, but the address of every txout having an indexed script pubkey. 🤔
|
Per team discussion today I'm closing this PR in favor of #393. |
1854b8e cleanup(wallet)!: remove cancel_tx function (Steve Myers) Pull request description: ### Description Per discussion in team chat today I'm removing the `Wallet::cancel_tx` function because it's name is misleading and the `Wallet::mark_unused` function can be used to accomplish the same function. closes #326 and closes #212 and closes #41 ### Notes to the reviewers This is an example of how to use `mark_unused` instead of `cancel_tx` ```rust /// This marks as unused the change addresses used when creating a tx so they can be used in future transactions. for txout in &tx.output { if let Some((keychain, index)) = txout_index.index_of_spk(txout.script_pubkey.clone()) { // NOTE: unmark_used will **not** make something unused if it has actually been used // by a tx in the tracker. It only removes the superficial marking. wallet.unmark_used(*keychain, *index); } } ``` ### Changelog notice - BREAKING: Remove Wallet::cancel_tx function. Use Wallet::unmark_used instead ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `just p` before pushing #### Bugfixes: * [x] This pull request breaks the existing API * [ ] I've added tests to reproduce the issue which are now passing * [x] I'm linking the issue being fixed by this PR ACKs for top commit: ValuedMammal: ACK 1854b8e Tree-SHA512: c5fe988c61591267ce4c96fa005355d30a24c006431e60b276ab4a18c0a7be336a53f6c9800b43ab3e915dcb5c1847827e624854c56c14039caf54df4d456758
Description
Renames
cancel_tx()tounreserve_change_address()to better reflect its current functionality, which only frees up the change address and does not yet handle UTXO reservation.Changelog notice
Changed
cancel_tx()tounreserve_change_address()for clarityCloses #212