@@ -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"
@@ -62,6 +63,11 @@ type AuxChanCloserCfg struct {
62
63
63
64
// ChainBridge is used to fetch blocks from the main chain.
64
65
ChainBridge tapgarden.ChainBridge
66
+
67
+ // AuxChanNegotiator is responsible for producing the extra tlv blob
68
+ // that is encapsulated in the init and reestablish peer messages. This
69
+ // helps us communicate custom feature bits with our peer.
70
+ AuxChanNegotiator * tapfeatures.AuxChannelNegotiator
65
71
}
66
72
67
73
// assetCloseInfo houses the information we need to finalize the close of an
@@ -450,11 +456,21 @@ func (a *AuxChanCloser) AuxCloseOutputs(
450
456
"packets: %w" , err )
451
457
}
452
458
459
+ features := a .cfg .AuxChanNegotiator .GetChannelFeatures (
460
+ lnwire .NewChanIDFromOutPoint (desc .ChanPoint ),
461
+ )
462
+ supportSTXO := features .HasFeature (tapfeatures .STXOOptional )
463
+
464
+ var opts []tapsend.OutputCommitmentOption
465
+ if ! supportSTXO {
466
+ opts = append (opts , tapsend .WithNoSTXOProofs ())
467
+ }
468
+
453
469
// With the outputs prepared, we can now create the set of output
454
470
// commitments, then with the output index locations known, we can set
455
471
// the output indexes in the allocations.
456
472
outCommitments , err := tapsend .CreateOutputCommitments (
457
- vPackets , tapsend . WithNoSTXOProofs () ,
473
+ vPackets , opts ... ,
458
474
)
459
475
if err != nil {
460
476
return none , fmt .Errorf ("unable to create output " +
@@ -723,10 +739,22 @@ func (a *AuxChanCloser) FinalizeClose(desc chancloser.AuxCloseDesc,
723
739
closeInfo .allocations ,
724
740
)
725
741
742
+ features := a .cfg .AuxChanNegotiator .GetChannelFeatures (
743
+ lnwire .NewChanIDFromOutPoint (desc .ChanPoint ),
744
+ )
745
+ supportSTXO := features .HasFeature (
746
+ tapfeatures .STXOOptional ,
747
+ )
748
+
749
+ var opts []proof.GenOption
750
+ if ! supportSTXO {
751
+ opts = append (opts , proof .WithNoSTXOProofs ())
752
+ }
753
+
726
754
proofSuffix , err := tapsend .CreateProofSuffixCustom (
727
755
closeTx , vPkt , closeInfo .outputCommitments ,
728
756
outIdx , closeInfo .vPackets , exclusionCreator ,
729
- proof . WithNoSTXOProofs () ,
757
+ opts ... ,
730
758
)
731
759
if err != nil {
732
760
return fmt .Errorf ("unable to create proof " +
0 commit comments