Skip to content

Commit 20657ea

Browse files
committed
Merge #581: Combine terminal variants
211f0cb Combine terminal variants (Tobin C. Harding) Pull request description: 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. ACKs for top commit: apoelstra: ACK 211f0cb Tree-SHA512: e61960e3ca0a8dd365a8cf38f3cbf15a6515592c3c1cc92c8abbb3b59ace9af0886a53d2733c8155bdfa712227d9be436f94c8754523a95e31d96b6e78c00330
2 parents 3ba195d + 211f0cb commit 20657ea

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

src/miniscript/satisfy.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,15 +1332,11 @@ impl Satisfaction {
13321332
stack: Witness::empty(),
13331333
has_sig: false,
13341334
},
1335-
Terminal::True => Satisfaction {
1336-
stack: Witness::Impossible,
1337-
has_sig: false,
1338-
},
1339-
Terminal::Older(_) => Satisfaction {
1340-
stack: Witness::Impossible,
1341-
has_sig: false,
1342-
},
1343-
Terminal::After(_) => Satisfaction {
1335+
Terminal::True
1336+
| Terminal::Older(_)
1337+
| Terminal::After(_)
1338+
| Terminal::Verify(_)
1339+
| Terminal::OrC(..) => Satisfaction {
13441340
stack: Witness::Impossible,
13451341
has_sig: false,
13461342
},
@@ -1361,10 +1357,6 @@ impl Satisfaction {
13611357
stack: Witness::push_0(),
13621358
has_sig: false,
13631359
},
1364-
Terminal::Verify(_) => Satisfaction {
1365-
stack: Witness::Impossible,
1366-
has_sig: false,
1367-
},
13681360
Terminal::AndV(ref v, ref other) => {
13691361
let vsat =
13701362
Self::satisfy_helper(&v.node, stfr, root_has_sig, leaf_hash, min_fn, thresh_fn);
@@ -1406,10 +1398,6 @@ impl Satisfaction {
14061398
has_sig: rnsat.has_sig || lnsat.has_sig,
14071399
}
14081400
}
1409-
Terminal::OrC(..) => Satisfaction {
1410-
stack: Witness::Impossible,
1411-
has_sig: false,
1412-
},
14131401
Terminal::OrI(ref l, ref r) => {
14141402
let lnsat = Self::dissatisfy_helper(
14151403
&l.node,

0 commit comments

Comments
 (0)