Skip to content

Commit 865bf4b

Browse files
committed
Thresh bug with equal verify
1 parent 42367cf commit 865bf4b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/miniscript/decode.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,13 @@ pub fn parse<Ctx: ScriptContext>(
280280
))?
281281
},
282282
),
283+
Tk::Num(k) => {
284+
non_term.push(NonTerm::Verify);
285+
non_term.push(NonTerm::ThreshW {
286+
k: k as usize,
287+
n: 0
288+
});
289+
},
283290
),
284291
x => {
285292
tokens.un_next(x);

src/miniscript/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,12 @@ mod tests {
874874
OP_PUSHNUM_1\
875875
)"
876876
);
877+
878+
// Thresh bug with equal verify roundtrip
879+
roundtrip(
880+
&ms_str!("tv:thresh(1,pk(02d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e))", ),
881+
"Script(OP_PUSHBYTES_33 02d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e OP_CHECKSIG OP_PUSHNUM_1 OP_EQUALVERIFY OP_PUSHNUM_1)",
882+
);
877883
}
878884

879885
#[test]

0 commit comments

Comments
 (0)