Closed dcousens closed 6 years ago
It isn't possible to carry around a chunks
Array
, as, P2WSH has no idea what chunks it should decode to. A canonical form is no simpler than the alternative of stackify/unstackify.
stackify
/unstackify
could be functions on their own - and they can be added when necessary.
The use case here is way too niche, specifically for hardcore TX development and introspection...
I don't think we need to generalize the API to suite that case.
p2wsh
automatically transforms redeem.input
to a redeem.witness
, if it can safely, otherwise it throws.
I don't think we need more than that.
Thoughts on an an
opts
argument for relevant scripts that might have been used in a P2WSH, and therefore had their stacks become.witness
data?Users would provide
{ stackify: true }
if.input
is provided and.witness
needed.And they would provide
{ unstackify: true }
if a.witness
is provided and.input
needed.Otherwise, if the signature data was required, fail.
Examples
edit: alternative naming
witnessify/unwitnessify
(or some other, suggestions open)