Why is policy valid with rust miniscript but throws a compile error on the sipa site?
Why is policy valid with rust miniscript but throws a compile error on the sipa site?
Loading saved threads...
jiamijiang · External communityPost link
External question — Bitcoin Stack Exchange
Author: jiamijiang
Original post: https://bitcoin.stackexchange.com/questions/131089
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Here's a policy I want to get working:
or(pk(MAIN),or(thresh(2,pk(KEY_1),pk(KEY_2),pk(KEY_3)),and(sha256(HASH_TARGET),older(144))))
It parses without issue in code:
...
let policy_string = format! (
"or(pk({}),or(thresh(2,pk({}),pk({}),pk({})),and(sha256({}),older(144))))",
pub_main_key, pub_a_key, pub_b_key, pub_c_key, hash_target
);
let policy: Concrete<DescriptorPublicKey> = policy_string.parse()
.expect("valid policy");
println!("{:#?}", {policy.to_string()});
...
But it throws a compile error when testing it in the 'Policy to Miniscript compiler' section of bitcoin.sipa.be/miniscript
Quote
Report
Pieter Wuille · External communityPost link
External answer — Bitcoin Stack Exchange
Author: Pieter Wuille
Original post: https://bitcoin.stackexchange.com/a/131090
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Two issues:
My site does not allow generic symbolic names for hash preimages, only for keys. You can use
H
however as a stand-in for a hash.
My site does not allow malleable scripts. Yours allows satisfying by just revealing the preimage after 144 blocks, which is inherently malleable as it involves no signatures.
The following works:
or(pk(MAIN),or(thresh(2,pk(KEY_1),pk(KEY_2),pk(KEY_3)),and(sha256(H),and(older(144),pk(F)))))
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Bitcoin Stack Exchange Author: jiamijiang Source score (net votes, not local likes): 0 Original post: https://bitcoin.stackexchange.com/questions/131089 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Here's a policy I want to get working: or(pk(MAIN),or(thresh(2,pk(KEY_1),pk(KEY_2),pk(KEY_3)),and(sha256(HASH_TARGET),older(144)))) It parses without issue in code: ... let policy_string = format! ( "or(pk({}),or(thresh(2,pk({}),pk({}),pk({})),and(sha256({}),older(144))))", pub_main_key, pub_a_key, pub_b_key, pub_c_key, hash_target ); let policy: Concrete<DescriptorPublicKey> = policy_string.parse() .expect("valid policy"); println!("{:#?}", {policy.to_string()}); ... But it throws a compile error when testing it in the 'Policy to Miniscript compiler' section of bitcoin.sipa.be/miniscript
Checking account access…