Skip to content

Commit

Permalink
Combine terminal variants
Browse files Browse the repository at this point in the history
We have various variants in this pattern that return the same thing, we
can combine them to make the code more terse with no loss of clarity.
  • Loading branch information
tcharding committed Jul 27, 2023
1 parent c8f9ee9 commit 211f0cb
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/miniscript/satisfy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1332,15 +1332,11 @@ impl Satisfaction {
stack: Witness::empty(),
has_sig: false,
},
Terminal::True => Satisfaction {
stack: Witness::Impossible,
has_sig: false,
},
Terminal::Older(_) => Satisfaction {
stack: Witness::Impossible,
has_sig: false,
},
Terminal::After(_) => Satisfaction {
Terminal::True
| Terminal::Older(_)
| Terminal::After(_)
| Terminal::Verify(_)
| Terminal::OrC(..) => Satisfaction {
stack: Witness::Impossible,
has_sig: false,
},
Expand All @@ -1361,10 +1357,6 @@ impl Satisfaction {
stack: Witness::push_0(),
has_sig: false,
},
Terminal::Verify(_) => Satisfaction {
stack: Witness::Impossible,
has_sig: false,
},
Terminal::AndV(ref v, ref other) => {
let vsat =
Self::satisfy_helper(&v.node, stfr, root_has_sig, leaf_hash, min_fn, thresh_fn);
Expand Down Expand Up @@ -1406,10 +1398,6 @@ impl Satisfaction {
has_sig: rnsat.has_sig || lnsat.has_sig,
}
}
Terminal::OrC(..) => Satisfaction {
stack: Witness::Impossible,
has_sig: false,
},
Terminal::OrI(ref l, ref r) => {
let lnsat = Self::dissatisfy_helper(
&l.node,
Expand Down

0 comments on commit 211f0cb

Please sign in to comment.