@@ -15,6 +15,7 @@ import (
15
15
"github.com/lightninglabs/taproot-assets/fn"
16
16
"github.com/lightninglabs/taproot-assets/proof"
17
17
"github.com/lightninglabs/taproot-assets/tapchannelmsg"
18
+ "github.com/lightninglabs/taproot-assets/tapfeatures"
18
19
"github.com/lightninglabs/taproot-assets/tapfreighter"
19
20
"github.com/lightninglabs/taproot-assets/tapgarden"
20
21
"github.com/lightninglabs/taproot-assets/tappsbt"
@@ -66,6 +67,11 @@ type AuxChanCloserCfg struct {
66
67
// IgnoreChecker is an optional function that can be used to check if
67
68
// a proof should be ignored.
68
69
IgnoreChecker lfn.Option [proof.IgnoreChecker ]
70
+
71
+ // AuxChanNegotiator is responsible for producing the extra tlv blob
72
+ // that is encapsulated in the init and reestablish peer messages. This
73
+ // helps us communicate custom feature bits with our peer.
74
+ AuxChanNegotiator * tapfeatures.AuxChannelNegotiator
69
75
}
70
76
71
77
// assetCloseInfo houses the information we need to finalize the close of an
@@ -454,11 +460,21 @@ func (a *AuxChanCloser) AuxCloseOutputs(
454
460
"packets: %w" , err )
455
461
}
456
462
463
+ features := a .cfg .AuxChanNegotiator .GetChannelFeatures (
464
+ lnwire .NewChanIDFromOutPoint (desc .ChanPoint ),
465
+ )
466
+ supportSTXO := features .HasFeature (tapfeatures .STXOOptional )
467
+
468
+ var opts []tapsend.OutputCommitmentOption
469
+ if ! supportSTXO {
470
+ opts = append (opts , tapsend .WithNoSTXOProofs ())
471
+ }
472
+
457
473
// With the outputs prepared, we can now create the set of output
458
474
// commitments, then with the output index locations known, we can set
459
475
// the output indexes in the allocations.
460
476
outCommitments , err := tapsend .CreateOutputCommitments (
461
- vPackets , tapsend . WithNoSTXOProofs () ,
477
+ vPackets , opts ... ,
462
478
)
463
479
if err != nil {
464
480
return none , fmt .Errorf ("unable to create output " +
@@ -733,10 +749,22 @@ func (a *AuxChanCloser) FinalizeClose(desc chancloser.AuxCloseDesc,
733
749
closeInfo .allocations ,
734
750
)
735
751
752
+ features := a .cfg .AuxChanNegotiator .GetChannelFeatures (
753
+ lnwire .NewChanIDFromOutPoint (desc .ChanPoint ),
754
+ )
755
+ supportSTXO := features .HasFeature (
756
+ tapfeatures .STXOOptional ,
757
+ )
758
+
759
+ var opts []proof.GenOption
760
+ if ! supportSTXO {
761
+ opts = append (opts , proof .WithNoSTXOProofs ())
762
+ }
763
+
736
764
proofSuffix , err := tapsend .CreateProofSuffixCustom (
737
765
closeTx , vPkt , closeInfo .outputCommitments ,
738
766
outIdx , closeInfo .vPackets , exclusionCreator ,
739
- proof . WithNoSTXOProofs () ,
767
+ opts ... ,
740
768
)
741
769
if err != nil {
742
770
return fmt .Errorf ("unable to create proof " +
0 commit comments