Skip to content

refactor(wallet)!: Remove Wallet::cancel_tx function#393

Merged
ValuedMammal merged 1 commit intobitcoindevkit:masterfrom
notmandatory:cleanup/remove_cancel_tx
Mar 4, 2026
Merged

refactor(wallet)!: Remove Wallet::cancel_tx function#393
ValuedMammal merged 1 commit intobitcoindevkit:masterfrom
notmandatory:cleanup/remove_cancel_tx

Conversation

@notmandatory
Copy link
Member

@notmandatory notmandatory commented Mar 3, 2026

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

/// 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:

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

Removed because its name is misleading and mark_unused can be used
to accomplish the same function.
@notmandatory notmandatory force-pushed the cleanup/remove_cancel_tx branch from 8c0a9c4 to 1854b8e Compare March 3, 2026 17:54
@notmandatory notmandatory self-assigned this Mar 3, 2026
@notmandatory notmandatory added the api A breaking API change label Mar 3, 2026
@notmandatory notmandatory moved this to Needs Review in BDK Wallet Mar 3, 2026
@notmandatory notmandatory added this to the Wallet 3.0.0 milestone Mar 3, 2026
@notmandatory notmandatory marked this pull request as ready for review March 3, 2026 17:58
Copy link
Collaborator

@ValuedMammal ValuedMammal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 1854b8e

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.08%. Comparing base (c422104) to head (1854b8e).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #393      +/-   ##
==========================================
- Coverage   79.17%   79.08%   -0.10%     
==========================================
  Files          24       24              
  Lines        5311     5302       -9     
  Branches      242      241       -1     
==========================================
- Hits         4205     4193      -12     
- Misses       1029     1032       +3     
  Partials       77       77              
Flag Coverage Δ
rust 79.08% <ø> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ValuedMammal ValuedMammal changed the title Remove Wallet::cancel_tx function refactor(wallet)!: Remove Wallet::cancel_tx function Mar 4, 2026
@ValuedMammal ValuedMammal merged commit c4a3b8c into bitcoindevkit:master Mar 4, 2026
16 of 17 checks passed
@github-project-automation github-project-automation bot moved this from Needs Review to Done in BDK Wallet Mar 4, 2026
@ValuedMammal ValuedMammal mentioned this pull request Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api A breaking API change

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Rename cancel_tx to unreserve_change_address cancel_tx has no effect

2 participants