@@ -82,6 +82,7 @@ func (s *AuxTrafficShaper) ShouldHandleTraffic(_ lnwire.ShortChannelID,
8282 // If there is no auxiliary blob in the channel, it's not a custom
8383 // channel, and we don't need to handle it.
8484 if fundingBlob .IsNone () {
85+ log .Tracef ("No aux funding blob set, not handling traffic" )
8586 return false , nil
8687 }
8788
@@ -113,6 +114,8 @@ func (s *AuxTrafficShaper) PaymentBandwidth(htlcBlob,
113114 // bandwidth from a taproot asset perspective. We return the link
114115 // bandwidth as a fallback.
115116 if commitmentBlob .IsNone () || htlcBlob .IsNone () {
117+ log .Tracef ("No commitment or HTLC blob set, returning link " +
118+ "bandwidth %v" , linkBandwidth )
116119 return linkBandwidth , nil
117120 }
118121
@@ -122,6 +125,16 @@ func (s *AuxTrafficShaper) PaymentBandwidth(htlcBlob,
122125 // Sometimes the blob is set but actually empty, in which case we also
123126 // don't have any information about the channel.
124127 if len (commitmentBytes ) == 0 || len (htlcBytes ) == 0 {
128+ log .Tracef ("Empty commitment or HTLC blob, returning link " +
129+ "bandwidth %v" , linkBandwidth )
130+ return linkBandwidth , nil
131+ }
132+
133+ // If there are no asset HTLC custom records, we don't need to do
134+ // anything as this is a regular payment.
135+ if ! rfqmsg .HasAssetHTLCEntries (htlcBytes ) {
136+ log .Tracef ("No asset HTLC custom records, returning link " +
137+ "bandwidth %v" , linkBandwidth )
125138 return linkBandwidth , nil
126139 }
127140
@@ -174,6 +187,9 @@ func (s *AuxTrafficShaper) PaymentBandwidth(htlcBlob,
174187 // it goes below the reserve, we report zero bandwidth as we
175188 // cannot push the HTLC amount.
176189 if linkBandwidth < htlcAmt {
190+ log .Tracef ("Link bandwidth %v smaller than HTLC " +
191+ "amount %d, returning 0 as we'd dip below " +
192+ "reserver otherwise" , linkBandwidth , htlcAmt )
177193 return 0 , nil
178194 }
179195
@@ -189,6 +205,8 @@ func (s *AuxTrafficShaper) PaymentBandwidth(htlcBlob,
189205 // If the HTLC doesn't have an asset amount and RFQ ID, it's incomplete,
190206 // and we cannot determine what channel to use.
191207 if htlc .RfqID .ValOpt ().IsNone () {
208+ log .Tracef ("No RFQ ID in HTLC, cannot determine matching " +
209+ "outgoing channel" )
192210 return 0 , nil
193211 }
194212
@@ -228,6 +246,9 @@ func (s *AuxTrafficShaper) PaymentBandwidth(htlcBlob,
228246 // to check if the link bandwidth can afford sending a non-dust htlc to
229247 // the other side.
230248 if linkBandwidth < minHtlcAmt {
249+ log .Tracef ("Link bandwidth %v smaller than HTLC min amount " +
250+ "%d, returning 0 as we'd dip below reserver otherwise" ,
251+ linkBandwidth , minHtlcAmt )
231252 return 0 , nil
232253 }
233254
@@ -243,7 +264,9 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi,
243264 htlcCustomRecords lnwire.CustomRecords ) (lnwire.MilliSatoshi ,
244265 lnwire.CustomRecords , error ) {
245266
246- if len (htlcCustomRecords ) == 0 {
267+ if ! rfqmsg .HasAssetHTLCCustomRecords (htlcCustomRecords ) {
268+ log .Tracef ("No asset HTLC custom records, not producing " +
269+ "extra data" )
247270 return totalAmount , nil , nil
248271 }
249272
@@ -258,6 +281,8 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi,
258281 // keysend payment and don't need to do anything. We even return the
259282 // original on-chain amount as we don't want to change it.
260283 if htlc .Amounts .Val .Sum () > 0 {
284+ log .Tracef ("Already have asset amount (sum %d) in HTLC, not " +
285+ "producing extra data" , htlc .Amounts .Val .Sum ())
261286 return totalAmount , htlcCustomRecords , nil
262287 }
263288
0 commit comments