File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -301,6 +301,15 @@ pub fn parse<Ctx: ScriptContext>(
301
301
// Note this does not collide with hash32 because they always followed by equal
302
302
// and would be parsed in different branch. If we get a naked Bytes32, it must be
303
303
// a x-only key
304
+ // In miniscript spec, bytes32 only occurs at three places.
305
+ // - during parsing XOnly keys in Pk fragment
306
+ // - during parsing XOnly keys in MultiA fragment
307
+ // - checking for 32 bytes hashlocks (sha256/hash256)
308
+ // The second case(MultiA) is disambiguated using NumEqual which is not used anywhere in miniscript
309
+ // The third case can only occur hashlocks is disambiguated because hashlocks start from equal, and
310
+ // it is impossible for any K type fragment to be followed by EQUAL in miniscript spec. Thus, EQUAL
311
+ // after bytes32 means bytes32 is in a hashlock
312
+ // Finally for the first case, K being parsed as a solo expression is a Pk type
304
313
Tk :: Bytes32 ( pk) => {
305
314
let ret = Ctx :: Key :: from_slice( pk) . map_err( |e| Error :: PubKeyCtxError ( e, Ctx :: name_str( ) ) ) ?;
306
315
term. reduce0( Terminal :: PkK ( ret) ) ?
You can’t perform that action at this time.
0 commit comments