Skip to content

Commit bb6347f

Browse files
committed
Add test case for compilation of pk()-only policies
Prior to this fix, the test failed with: `Unexpected("Empty Miniscript compilation")`
1 parent 59fb310 commit bb6347f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/policy/concrete.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,14 @@ mod compiler_tests {
11301130
.collect::<Vec<_>>();
11311131
assert_eq!(combinations, expected_comb);
11321132
}
1133+
1134+
#[test]
1135+
fn test_tr_pk_only() {
1136+
let policy: Policy<String> = policy_str!("pk(A)");
1137+
let desc = policy.compile_tr(None).unwrap();
1138+
// pk(A) promoted to the internal key, leaving the script tree empty
1139+
assert_eq!(desc.to_string(), "tr(A)#xyg3grex");
1140+
}
11331141
}
11341142

11351143
#[cfg(test)]

0 commit comments

Comments
 (0)