fix: remove deprecated `max_satisfaction_weight
- Change deprecated `max_satisfaction_weight` to `max_weight_to_satisfy` - Remove `#[allow(deprecated)]` flags - updates the calculations in TXIN_BASE_WEIGHT and P2WPKH_SATISFACTION_SIZE Update crates/bdk/src/wallet/coin_selection.rs Co-authored-by: ValuedMammal <valuedmammal@protonmail.com>
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};
|
||||
@@ -1712,10 +1711,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 {
|
||||
@@ -1733,7 +1731,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),
|
||||
@@ -1743,6 +1740,7 @@ impl<D> Wallet<D> {
|
||||
..Default::default()
|
||||
}),
|
||||
},
|
||||
satisfaction_weight,
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -2057,13 +2055,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