Closed sanket1729 closed 3 years ago
fuzz failure on elc:pk_h()
in the roundtrip_descriptor
test. i think this isn't related to this PR
ok ack 5bc92d309149633798b4fb58c1402cdf38f35096 with the following caveats
CAT
s based on the length of the prefixThis PR is pretty big, I think it's fine to merge and address these in a followup.
should change the itempref stuff to allow a variable number of CATs based on the length of the prefix
I would like to revisit having this. Because it is a significant code change in the decoding logic and complicates it.
1) First off, it is barely saving anything. In most cases, the prefix will be less than 80 bytes, so we will end up with 6 CATs anyways.
2) Secondly, in decode.rs
, we would have multiple conditionals depending on the length of the prefix.
Note that these CAT
s are for suffix and not for prefix. The prefix is always pushed in 1 go, regardless of the size. The policy rule for 80 bytes is only for the initial witness stack and for prefix which is provided in script pubkey.
I don't understand your first point -- if the prefix is less than 80 bytes, then we have six CAT
s but actually none are needed. So we'd save six bytes in this case.
The CATs are for the suffix which the user provides as witness, not the prefix. The prefix (even if > 80 bytes) can be pushed in 1 go, it is the suffix that needs CATs. The witness policy rule only restricts pushes in the initial witness stack. We can push anything we want in the committed witness script.
For example, if we want to fix the first output(say 75 bytes) in a tx with serialized outputs 500 bytes. The user has to provide the suffix (500 -75 = 425) bytes in chunks of 80.
Oh! Yes, I see, sorry
Adds interpreter support and a generic testing mechanism to test more fragments we will add in the near future.