Skip to content

Commit

Permalink
use max_weight_to_satisfy instead of deprecated max_satisfaction_weight
Browse files Browse the repository at this point in the history
  • Loading branch information
RCasatta committed Mar 1, 2024
1 parent d3f638d commit d501a13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/descriptor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,12 @@ impl<Pk: MiniscriptKey> Descriptor<Pk> {
)]
pub fn max_satisfaction_weight(&self) -> Result<usize, Error> {
let weight = match *self {
Descriptor::Bare(ref bare) => bare.max_satisfaction_weight()?,
Descriptor::Pkh(ref pkh) => pkh.max_satisfaction_weight(),
Descriptor::Wpkh(ref wpkh) => wpkh.max_satisfaction_weight(),
Descriptor::Wsh(ref wsh) => wsh.max_satisfaction_weight()?,
Descriptor::Sh(ref sh) => sh.max_satisfaction_weight()?,
Descriptor::Tr(ref tr) => tr.max_satisfaction_weight()?,
Descriptor::Bare(ref bare) => bare.max_weight_to_satisfy()?,
Descriptor::Pkh(ref pkh) => pkh.max_weight_to_satisfy(),
Descriptor::Wpkh(ref wpkh) => wpkh.max_weight_to_satisfy(),
Descriptor::Wsh(ref wsh) => wsh.max_weight_to_satisfy()?,
Descriptor::Sh(ref sh) => sh.max_weight_to_satisfy()?,
Descriptor::Tr(ref tr) => tr.max_weight_to_satisfy()?,
};
Ok(weight)
}
Expand Down
4 changes: 2 additions & 2 deletions src/descriptor/sh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,15 @@ impl<Pk: MiniscriptKey> Sh<Pk> {
pub fn max_satisfaction_weight(&self) -> Result<usize, Error> {
Ok(match self.inner {
// add weighted script sig, len byte stays the same
ShInner::Wsh(ref wsh) => 4 * 35 + wsh.max_satisfaction_weight()?,
ShInner::Wsh(ref wsh) => 4 * 35 + wsh.max_weight_to_satisfy()?,
ShInner::SortedMulti(ref smv) => {
let ss = smv.script_size();
let ps = push_opcode_size(ss);
let scriptsig_len = ps + ss + smv.max_satisfaction_size();
4 * (varint_len(scriptsig_len) + scriptsig_len)
}
// add weighted script sig, len byte stays the same
ShInner::Wpkh(ref wpkh) => 4 * 23 + wpkh.max_satisfaction_weight(),
ShInner::Wpkh(ref wpkh) => 4 * 23 + wpkh.max_weight_to_satisfy(),
ShInner::Ms(ref ms) => {
let ss = ms.script_size();
let ps = push_opcode_size(ss);
Expand Down

0 comments on commit d501a13

Please sign in to comment.