4242 PsbtKeyTypeInputTapAnchorTapscriptSibling = []byte {0x78 }
4343 PsbtKeyTypeInputTapAsset = []byte {0x79 }
4444 PsbtKeyTypeInputTapAssetProof = []byte {0x7a }
45+ PsbtKeyTypeInputAltLeaves = []byte {0x7b }
4546
4647 PsbtKeyTypeOutputTapType = []byte {0x70 }
4748 PsbtKeyTypeOutputTapIsInteractive = []byte {0x71 }
5758 PsbtKeyTypeOutputTapAssetProofSuffix = []byte {0x7b }
5859 PsbtKeyTypeOutputTapAssetLockTime = []byte {0x7c }
5960 PsbtKeyTypeOutputTapAssetRelativeLockTime = []byte {0x7d }
61+ PsbtKeyTypeOutputTapAltLeaves = []byte {0x7e }
6062)
6163
6264// The following keys are used as custom fields on the BTC level anchor
@@ -104,6 +106,9 @@ type bip32DerivationPredicate func(*psbt.Bip32Derivation) bool
104106// BIP-0032 derivation paths.
105107type taprootBip32DerivationPredicate func (* psbt.TaprootBip32Derivation ) bool
106108
109+ // AltLeafAsset is an AltLeaf backed by an Asset object.
110+ type AltLeafAsset = asset.AltLeaf [* asset.Asset ]
111+
107112var (
108113 // VOutIsSplitRoot is a predicate that returns true if the virtual
109114 // output is a split root output.
@@ -370,6 +375,12 @@ type VInput struct {
370375 // Proof is a transition proof that proves the asset being spent was
371376 // committed to in the anchor transaction above.
372377 Proof * proof.Proof
378+
379+ // AltLeaves represent data used to construct an Asset commitment, that
380+ // will be inserted in the input anchor Tap commitment. These
381+ // data-carrying leaves are used for a purpose distinct from
382+ // representing individual Taproot Assets.
383+ AltLeaves []AltLeafAsset
373384}
374385
375386// Copy creates a deep copy of the VInput.
@@ -382,7 +393,8 @@ func (i *VInput) Copy() *VInput {
382393 // We never expect the individual fields of the proof to change
383394 // while it is assigned to a virtual input. So not deep copying
384395 // it here is fine.
385- Proof : i .Proof ,
396+ Proof : i .Proof ,
397+ AltLeaves : asset .CopyAltLeaves (i .AltLeaves ),
386398 }
387399}
388400
@@ -563,6 +575,12 @@ type VOutput struct {
563575 // since the header information needs to be added once the anchor
564576 // transaction was confirmed in a block.
565577 ProofSuffix * proof.Proof
578+
579+ // AltLeaves represent data used to construct an Asset commitment, that
580+ // will be inserted in the output anchor Tap commitment. These
581+ // data-carrying leaves are used for a purpose distinct from
582+ // representing individual Taproot Assets.
583+ AltLeaves []AltLeafAsset
566584}
567585
568586// Copy creates a deep copy of the VOutput.
@@ -590,6 +608,7 @@ func (o *VOutput) Copy() *VOutput {
590608 ScriptKey : o .ScriptKey ,
591609 ProofDeliveryAddress : o .ProofDeliveryAddress ,
592610 ProofSuffix : o .ProofSuffix ,
611+ AltLeaves : asset .CopyAltLeaves (o .AltLeaves ),
593612 }
594613}
595614
0 commit comments