Skip to main content
edited title
Link

and(older(10),pk(A)) malleable if top-level, can it be top-level? EDIT: not malleable, was mistaken

Source Link

and(older(10),pk(A)) malleable if top-level, can it be top-level?

$ ./miniscript 

and(older(10),pk(A))
X    110.0000000000    37 and_v(v:pk(A),older(10)) and(older(10),pk(A))

and_v(v:pk(A),older(10))
      1 scriptlen=37 maxops=2 type=B safe=yes nonmal=yes dissat=no input=1n output=nonzero miniscript=and_v(v:pk(A),older(10))
<A> OP_CHECKSIGVERIFY 10 OP_CHECKSEQUENCEVERIFY

(the last line shows the compiled script because I added printf("%s", Disassemble(ret->ToScript(COMPILER_CTX)).c_str()); to the command line-based tool output)

AFAICT nothing says that this cannot be top-level (but I may be missing something). It also says nonmal=yes, that this is not malleable.

The witness that is needed for this script to be successfully executed in the spending check is [<A_signature>, <any-nonzero>], and of course the CHECKSEQUENCEVERIFY condition must pass. The CHECKSIGVERIFY will consume <A_signature>, and then <any-nonzero> will be checked as the sole item on the stack, that indicates success (after CastToBool())

But <any-nonzero> can be just that, anything, and thus malleable.

What am I missing ?