diff --git a/src/wallet/mod.rs b/src/wallet/mod.rs index 273b5f6f..aa0df8c4 100644 --- a/src/wallet/mod.rs +++ b/src/wallet/mod.rs @@ -2093,11 +2093,11 @@ impl Wallet { .0 } - /// Informs the wallet that you no longer intend to broadcast a tx that was built from it. + /// Unreserves the change address used in a transaction that will not be broadcast. /// /// 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) { let txout_index = &mut self.indexed_graph.index; for txout in &tx.output { if let Some((keychain, index)) = txout_index.index_of_spk(txout.script_pubkey.clone()) { diff --git a/tests/wallet.rs b/tests/wallet.rs index c779c0a4..a67728fb 100644 --- a/tests/wallet.rs +++ b/tests/wallet.rs @@ -2801,7 +2801,7 @@ fn test_tx_cancellation() { .unwrap(); assert_eq!(change_derivation_2, (KeychainKind::Internal, 1)); - wallet.cancel_tx(&psbt1.extract_tx().expect("failed to extract tx")); + wallet.unreserve_change_address(&psbt1.extract_tx().expect("failed to extract tx")); let psbt3 = new_tx!(wallet); let change_derivation_3 = psbt3 @@ -2821,7 +2821,7 @@ fn test_tx_cancellation() { .unwrap(); assert_eq!(change_derivation_3, (KeychainKind::Internal, 2)); - wallet.cancel_tx(&psbt3.extract_tx().expect("failed to extract tx")); + wallet.unreserve_change_address(&psbt3.extract_tx().expect("failed to extract tx")); let psbt3 = new_tx!(wallet); let change_derivation_4 = psbt3