@@ -14,6 +14,7 @@ import (
14
14
"github.com/lightninglabs/taproot-assets/rfqmath"
15
15
"github.com/lightninglabs/taproot-assets/rfqmsg"
16
16
cmsg "github.com/lightninglabs/taproot-assets/tapchannelmsg"
17
+ "github.com/lightninglabs/taproot-assets/tapfeatures"
17
18
lfn "github.com/lightningnetwork/lnd/fn/v2"
18
19
"github.com/lightningnetwork/lnd/lntypes"
19
20
"github.com/lightningnetwork/lnd/lnutils"
@@ -30,6 +31,8 @@ type TrafficShaperConfig struct {
30
31
31
32
RfqManager * rfq.Manager
32
33
34
+ AuxChanNegotiator * tapfeatures.AuxChannelNegotiator
35
+
33
36
// NoOpHTLCs is a boolean indicating whether the daemon configuration
34
37
// wants us to produce NoOp HTLCs.
35
38
NoopHTLCs bool
@@ -464,6 +467,9 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi,
464
467
return totalAmount , nil , nil
465
468
}
466
469
470
+ peerFeatures := s .cfg .AuxChanNegotiator .GetPeerFeatures (peer )
471
+ supportNoOp := peerFeatures .HasFeature (tapfeatures .NoOpHTLCsOptional )
472
+
467
473
// We need to do a round trip to convert the custom records to a blob
468
474
// that we can then parse into the correct struct again.
469
475
htlc , err := rfqmsg .HtlcFromCustomRecords (htlcCustomRecords )
@@ -478,7 +484,7 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi,
478
484
log .Tracef ("Already have asset amount (sum %d) in HTLC, not " +
479
485
"producing extra data" , htlc .Amounts .Val .Sum ())
480
486
481
- if s .cfg .NoopHTLCs {
487
+ if s .cfg .NoopHTLCs && supportNoOp {
482
488
htlc .SetNoopAdd (rfqmsg .UseNoOpHTLCs )
483
489
}
484
490
@@ -587,7 +593,7 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi,
587
593
// Now we set the flag that marks this HTLC as a noop_add, which means
588
594
// that the above dust will eventually return to us. This means that
589
595
// only the assets will be sent and not any btc balance.
590
- if s .cfg .NoopHTLCs {
596
+ if s .cfg .NoopHTLCs && supportNoOp {
591
597
htlc .SetNoopAdd (rfqmsg .UseNoOpHTLCs )
592
598
}
593
599
0 commit comments