Skip to content

Commit 3f7ff2d

Browse files
committed
Rename cancel_tx to unreserve_change_address to align with functionality
1 parent 321c8a0 commit 3f7ff2d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/wallet/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,11 +2093,11 @@ impl Wallet {
20932093
.0
20942094
}
20952095

2096-
/// Informs the wallet that you no longer intend to broadcast a tx that was built from it.
2096+
/// Unreserves the change address used in a transaction that will not be broadcast.
20972097
///
20982098
/// This frees up the change address used when creating the tx for use in future transactions.
20992099
// TODO: Make this free up reserved utxos when that's implemented
2100-
pub fn cancel_tx(&mut self, tx: &Transaction) {
2100+
pub fn unreserve_change_address(&mut self, tx: &Transaction) {
21012101
let txout_index = &mut self.indexed_graph.index;
21022102
for txout in &tx.output {
21032103
if let Some((keychain, index)) = txout_index.index_of_spk(txout.script_pubkey.clone()) {

tests/wallet.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,7 +2801,7 @@ fn test_tx_cancellation() {
28012801
.unwrap();
28022802
assert_eq!(change_derivation_2, (KeychainKind::Internal, 1));
28032803

2804-
wallet.cancel_tx(&psbt1.extract_tx().expect("failed to extract tx"));
2804+
wallet.unreserve_change_address(&psbt1.extract_tx().expect("failed to extract tx"));
28052805

28062806
let psbt3 = new_tx!(wallet);
28072807
let change_derivation_3 = psbt3
@@ -2821,7 +2821,7 @@ fn test_tx_cancellation() {
28212821
.unwrap();
28222822
assert_eq!(change_derivation_3, (KeychainKind::Internal, 2));
28232823

2824-
wallet.cancel_tx(&psbt3.extract_tx().expect("failed to extract tx"));
2824+
wallet.unreserve_change_address(&psbt3.extract_tx().expect("failed to extract tx"));
28252825

28262826
let psbt3 = new_tx!(wallet);
28272827
let change_derivation_4 = psbt3

0 commit comments

Comments
 (0)