Skip to content

Commit 9fd3939

Browse files
committed
docs(wallet): add warning on TxBuilder::allow_shrinking() and deprecate it
test(wallet): add test_bump_fee_allow_shrinking test
1 parent 04994e4 commit 9fd3939

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [Unreleased]
1111

12+
## [v0.30.0]
13+
14+
### Summary
15+
16+
This maintenance release updates the project MSRV to 1.63.0 and deprecates `TxBuilder::allow_shrinking()`.
17+
1218
## [v0.29.0]
1319

1420
### Summary
@@ -693,4 +699,5 @@ final transaction is created by calling `finish` on the builder.
693699
[v0.28.1]: https://github.com/bitcoindevkit/bdk/compare/v0.28.0...v0.28.1
694700
[v0.28.2]: https://github.com/bitcoindevkit/bdk/compare/v0.28.1...v0.28.2
695701
[v0.29.0]: https://github.com/bitcoindevkit/bdk/compare/v0.28.2...v0.29.0
696-
[Unreleased]: https://github.com/bitcoindevkit/bdk/compare/v0.29.0...HEAD
702+
[v0.30.0]: https://github.com/bitcoindevkit/bdk/compare/v0.29.0...v0.30.0
703+
[Unreleased]: https://github.com/bitcoindevkit/bdk/compare/v0.30.0...HEAD

src/wallet/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3526,6 +3526,7 @@ pub(crate) mod test {
35263526
assert_eq!(details.fee.unwrap_or(0), 200);
35273527
}
35283528

3529+
#[allow(deprecated)]
35293530
#[test]
35303531
fn test_bump_fee_reduce_single_recipient() {
35313532
let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
@@ -3572,6 +3573,7 @@ pub(crate) mod test {
35723573
assert_fee_rate!(psbt, details.fee.unwrap_or(0), FeeRate::from_sat_per_vb(2.5), @add_signature);
35733574
}
35743575

3576+
#[allow(deprecated)]
35753577
#[test]
35763578
fn test_bump_fee_absolute_reduce_single_recipient() {
35773579
let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
@@ -3618,6 +3620,7 @@ pub(crate) mod test {
36183620
assert_eq!(details.fee.unwrap_or(0), 300);
36193621
}
36203622

3623+
#[allow(deprecated)]
36213624
#[test]
36223625
fn test_bump_fee_drain_wallet() {
36233626
let (wallet, descriptors, _) = get_funded_wallet(get_test_wpkh());
@@ -4208,6 +4211,7 @@ pub(crate) mod test {
42084211
builder.finish().unwrap();
42094212
}
42104213

4214+
#[allow(deprecated)]
42114215
#[test]
42124216
fn test_bump_fee_unconfirmed_input() {
42134217
// We create a tx draining the wallet and spending one confirmed

src/wallet/tx_builder.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,12 +653,20 @@ impl<'a, D: BatchDatabase> TxBuilder<'a, D, DefaultCoinSelectionAlgorithm, BumpF
653653
/// `script_pubkey` in order to bump the transaction fee. Without specifying this the wallet
654654
/// will attempt to find a change output to shrink instead.
655655
///
656+
/// **Warning**, use with extreme caution. The specified `script_pubkey` will be used _instead_
657+
/// of a change address and if the total transaction input amounts are greater than the required
658+
/// outputs + transaction fee the remaining change sats will also be sent to this address.
659+
///
656660
/// **Note** that the output may shrink to below the dust limit and therefore be removed. If it is
657661
/// preserved then it is currently not guaranteed to be in the same position as it was
658662
/// originally.
659663
///
660664
/// Returns an `Err` if `script_pubkey` can't be found among the recipients of the
661665
/// transaction we are bumping.
666+
#[deprecated(
667+
since = "0.30.0",
668+
note = "This function will be removed in the next release."
669+
)]
662670
pub fn allow_shrinking(&mut self, script_pubkey: ScriptBuf) -> Result<&mut Self, Error> {
663671
match self
664672
.params

0 commit comments

Comments
 (0)