You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #871: Remove a bit of validation-related cruft
bd8fca6 miniscript: replace decode_with_ext(., Ext::allow_all) with decode_consensus (Andrew Poelstra)
3dd006a miniscript: remove Ctx::check_witness (Andrew Poelstra)
Pull request description:
This PR contains two mostly-unrelated commits.
The first removes the `Ctx::check_witness` function, which is a no-op for the overwhelmingly common case that users are working with sane Miniscripts, and probably wrong in uncommon cases.
The second one removes the `decode_insane` method, replacing it with `decode_consensus` which allows much more stuff. The premise here is that "insane" Miniscripts are about allowing well-formed scripts that might not be analyzable because they violate some sanity rules, while "consensus" Miniscripts are anything the library can parse, no matter how half-baked or incomplete it is. When parsing strings we want "insane", when parsing on-chain scripts we want "consensus". The difference, for now, is that "consensus" Miniscripts can have raw pkhs while "insane" ones cannot.
More details in the commit messages.
ACKs for top commit:
tcharding:
ACK bd8fca6 - My review does not hold much weight.
sanket1729:
ACK bd8fca6
Tree-SHA512: c889fc66debde8bc8942ad1db5522ece660cded6962a7b3833d5465759a69063f57ea1283fccb89ad66836ec58114fb7ffb57586440e31c0917caf7b658c8fb9
let deser = Segwitv0Script::decode_insane(&ser).expect("deserialize result of serialize");
1167
+
let deser =
1168
+
Segwitv0Script::decode_consensus(&ser).expect("deserialize result of serialize");
1178
1169
assert_eq!(*tree, deser);
1179
1170
}
1180
1171
@@ -1315,19 +1306,19 @@ mod tests {
1315
1306
fnverify_parse(){
1316
1307
let ms = "and_v(v:hash160(20195b5a3d650c17f0f29f91c33f8f6335193d07),or_d(sha256(96de8fc8c256fa1e1556d41af431cace7dca68707c78dd88c3acab8b17164c47),older(16)))";
1317
1308
let ms:Segwitv0Script = Miniscript::from_str_insane(ms).unwrap();
let ms = "and_v(v:sha256(96de8fc8c256fa1e1556d41af431cace7dca68707c78dd88c3acab8b17164c47),or_d(sha256(96de8fc8c256fa1e1556d41af431cace7dca68707c78dd88c3acab8b17164c47),older(16)))";
1321
1312
let ms:Segwitv0Script = Miniscript::from_str_insane(ms).unwrap();
let ms = "and_v(v:ripemd160(20195b5a3d650c17f0f29f91c33f8f6335193d07),or_d(sha256(96de8fc8c256fa1e1556d41af431cace7dca68707c78dd88c3acab8b17164c47),older(16)))";
1325
1316
let ms:Segwitv0Script = Miniscript::from_str_insane(ms).unwrap();
let ms = "and_v(v:hash256(96de8fc8c256fa1e1556d41af431cace7dca68707c78dd88c3acab8b17164c47),or_d(sha256(96de8fc8c256fa1e1556d41af431cace7dca68707c78dd88c3acab8b17164c47),older(16)))";
1329
1320
let ms:Segwitv0Script = Miniscript::from_str_insane(ms).unwrap();
0 commit comments