Skip to content

Commit cbe83c7

Browse files
committed
taproot: Workaround for a bug in rust-miniscript
Pending a release with rust-bitcoin/rust-miniscript#677
1 parent e3d1162 commit cbe83c7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/stdlib/taproot.rs

+4
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ pub fn tr(a: Value, b: Option<Value>, scope: &Scope) -> Result<Value> {
173173
};
174174

175175
Ok(match (a, b) {
176+
// Workaround for a bug in rust-miniscript, pending https://github.com/rust-bitcoin/rust-miniscript/pull/677
177+
(Value::Policy(Policy::Key(pk)), None) => Descriptor::new_tr(pk, None)?.into(),
178+
176179
// tr(Policy) -> Descriptor
177180
// Single policy, compiled into a script tree
178181
// Extracts the internal key from the policy, or uses the TR_UNSPENDABLE key
@@ -364,6 +367,7 @@ fn descriptor_from_policy(
364367
// If no key was provided, use the policy as-is
365368
None => policy,
366369
};
370+
367371
Ok(policy.compile_tr(unspendable)?)
368372
}
369373

0 commit comments

Comments
 (0)