Merge bitcoindevkit/bdk#1345: fix: remove deprecated max_satisfaction_weight
798ed8ced2fix: remove deprecated `max_satisfaction_weight (Jose Storopoli) Pull request description: ### Description Continuation of #1115. Closes #1036. * Change deprecated `max_satisfaction_weight` to `max_weight_to_satisfy` * Remove `#[allow(deprecated)]` flags ### Notes to the reviewers I've changed all `max_satisfaction_weight()` to `max_weight_to_satisfy()` in `Wallet.get_available_utxo()` and `Wallet.build_fee_bump()`. Checking the docs on the `miniscript` crate for `max_weight_to_satisfy` has the following note: We are testing if the underlying descriptor `is.segwit()` or `.is_taproot`, then adding 4WU if true or leaving as it is otherwise. Another thing, we are not testing in BDK tests for legacy (pre-segwit) descriptors. Should I also add them to this PR? ### Changelog notice ### Fixed Replace the deprecated `max_satisfaction_weight` from `rust-miniscript` to `max_weight_to_satisfy`. ### 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 `cargo fmt` and `cargo clippy` before committing #### Bugfixes: * [ ] 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: evanlinjin: ACK798ed8ced2Tree-SHA512: 60babecee13c24915348ddb64894127a76a59d9421d52ea37acc714913685d57cc2be1904f9d0508078dd1db1f7d7dad83a734af5ee981801ca87de2e9984429
This commit is contained in:
@@ -54,7 +54,6 @@ pub(crate) mod utils;
|
||||
pub mod error;
|
||||
pub use utils::IsDust;
|
||||
|
||||
#[allow(deprecated)]
|
||||
use coin_selection::DefaultCoinSelectionAlgorithm;
|
||||
use signer::{SignOptions, SignerOrdering, SignersContainer, TransactionSigner};
|
||||
use tx_builder::{BumpFee, CreateTx, FeePolicy, TxBuilder, TxParams};
|
||||
@@ -1714,10 +1713,9 @@ impl<D> Wallet<D> {
|
||||
|
||||
let weighted_utxo = match txout_index.index_of_spk(&txout.script_pubkey) {
|
||||
Some((keychain, derivation_index)) => {
|
||||
#[allow(deprecated)]
|
||||
let satisfaction_weight = self
|
||||
.get_descriptor_for_keychain(keychain)
|
||||
.max_satisfaction_weight()
|
||||
.max_weight_to_satisfy()
|
||||
.unwrap();
|
||||
WeightedUtxo {
|
||||
utxo: Utxo::Local(LocalOutput {
|
||||
@@ -1735,7 +1733,6 @@ impl<D> Wallet<D> {
|
||||
let satisfaction_weight =
|
||||
serialize(&txin.script_sig).len() * 4 + serialize(&txin.witness).len();
|
||||
WeightedUtxo {
|
||||
satisfaction_weight,
|
||||
utxo: Utxo::Foreign {
|
||||
outpoint: txin.previous_output,
|
||||
sequence: Some(txin.sequence),
|
||||
@@ -1745,6 +1742,7 @@ impl<D> Wallet<D> {
|
||||
..Default::default()
|
||||
}),
|
||||
},
|
||||
satisfaction_weight,
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -2059,13 +2057,11 @@ impl<D> Wallet<D> {
|
||||
self.list_unspent()
|
||||
.map(|utxo| {
|
||||
let keychain = utxo.keychain;
|
||||
#[allow(deprecated)]
|
||||
(
|
||||
utxo,
|
||||
(utxo, {
|
||||
self.get_descriptor_for_keychain(keychain)
|
||||
.max_satisfaction_weight()
|
||||
.unwrap(),
|
||||
)
|
||||
.max_weight_to_satisfy()
|
||||
.unwrap()
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user