Closed sstone closed 2 months ago
I don't understand why the
ScriptTree
encoding is necessary, you don't seem to use it for the PSBT fields (which only require encoding/decoding script leaves)? Also, the leaf encoding defined in the PSBT bip doesn't match the encoding you're using?
Because we persist input information along with our peer's signature (or partial signature) in both eclair
and lightning-kmp
and for taproot outputs that includes a scrip tree. It's not related to PSBT but I'll see if I can reuse the format that has been proposed.
Got it, that's what confused me, this is unrelated to PSBT. It seems to me that we only need to serialize the leaves in order to re-build the tree, don't we? We would lose the "leafIndex" but maybe we can re-work that to get rid of it?
I've added the serialisation format for script trees defined in BIP371 (and kept ours which I find simpler :)).
We need to be able to serialize taproot script trees, compare x-only pubkeys, and create taproot sessions to verify partial signatures. This changes are imported from https://github.com/ACINQ/bitcoin-kmp/pull/128 which includes unrelated more complex changes to our PSBT implementation,