Skip to content

Commit 5ba9bfe

Browse files
authored
Merge pull request #75 from kiminuo/feature/issue_67
Fix roundtrip_miniscript_script that fails on `006400675168`
2 parents 53364e6 + 1019be4 commit 5ba9bfe

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/descriptor/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,7 @@ mod tests {
542542

543543
type StdDescriptor = Descriptor<PublicKey>;
544544
const TEST_PK: &'static str =
545-
"pk(\
546-
020000000000000000000000000000000000000000000000000000000000000002\
547-
)";
545+
"pk(020000000000000000000000000000000000000000000000000000000000000002)";
548546

549547
#[test]
550548
fn parse_descriptor() {

src/miniscript/decode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ pub fn parse(tokens: &mut TokenIter) -> Result<Miniscript<bitcoin::PublicKey>, E
386386
let a = term.pop().unwrap();
387387
let b = term.pop().unwrap();
388388
let c = term.pop().unwrap();
389-
let wrapped_ms = Terminal::AndOr(Arc::new(a), Arc::new(b), Arc::new(c));
389+
let wrapped_ms = Terminal::AndOr(Arc::new(a), Arc::new(c), Arc::new(b));
390390

391391
let ty = Type::type_check(&wrapped_ms, return_none)?;
392392
let ext = ExtData::type_check(&wrapped_ms, return_none)?;

src/miniscript/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,10 @@ mod tests {
569569
"Script(OP_PUSHNUM_1 OP_VERIFY OP_PUSHNUM_1)",
570570
);
571571
roundtrip(&ms_str!("0"), "Script(OP_0)");
572+
roundtrip(
573+
&ms_str!("andor(0,1,0)"),
574+
"Script(OP_0 OP_NOTIF OP_0 OP_ELSE OP_PUSHNUM_1 OP_ENDIF)",
575+
);
572576

573577
assert!(Miniscript::<bitcoin::PublicKey>::from_str("1()").is_err());
574578
assert!(Miniscript::<bitcoin::PublicKey>::from_str("tv:1()").is_err());

0 commit comments

Comments
 (0)