@@ -144,28 +144,6 @@ func (s *AuxTrafficShaper) PaymentBandwidth(htlcBlob,
144144 return linkBandwidth , nil
145145 }
146146
147- // Get the minimum HTLC amount, which is just above dust.
148- minHtlcAmt := rfqmath .DefaultOnChainHtlcMSat
149-
150- // LND calls this hook twice. Once to see if the overall budget of the
151- // node is enough, and then during pathfinding to actually see if
152- // there's enough balance in the channel to make the payment attempt.
153- //
154- // When doing the overall balance check, we don't know what the actual
155- // htlcAmt is in satoshis, so a value of 0 will be passed here. Let's at
156- // least check if we can afford the min amount above dust. If the actual
157- // htlc amount ends up being greater when calling this method during
158- // pathfinding, we will still check it below.
159-
160- // If the passed htlcAmt is below dust, then assume the dust amount. At
161- // this point we know we are sending assets, so we cannot anchor them to
162- // dust amounts. Dust HTLCs are added to the fees and aren't
163- // materialized in an on-chain output, so we wouldn't have anything
164- // to anchor the asset commitment to.
165- if htlcAmt < minHtlcAmt {
166- htlcAmt = minHtlcAmt
167- }
168-
169147 commitment , err := cmsg .DecodeCommitment (commitmentBytes )
170148 if err != nil {
171149 return 0 , fmt .Errorf ("error decoding commitment blob: %w" , err )
@@ -196,6 +174,28 @@ func (s *AuxTrafficShaper) PaymentBandwidth(htlcBlob,
196174 return prettyPrintLocalView (* decodedView )
197175 }))
198176
177+ // Get the minimum HTLC amount, which is just above dust.
178+ minHtlcAmt := rfqmath .DefaultOnChainHtlcMSat
179+
180+ // LND calls this hook twice. Once to see if the overall budget of the
181+ // node is enough, and then during pathfinding to actually see if
182+ // there's enough balance in the channel to make the payment attempt.
183+ //
184+ // When doing the overall balance check, we don't know what the actual
185+ // htlcAmt is in satoshis, so a value of 0 will be passed here. Let's at
186+ // least check if we can afford the min amount above dust. If the actual
187+ // htlc amount ends up being greater when calling this method during
188+ // pathfinding, we will still check it below.
189+
190+ // If the passed htlcAmt is below dust, then assume the dust amount. At
191+ // this point we know we are sending assets, so we cannot anchor them to
192+ // dust amounts. Dust HTLCs are added to the fees and aren't
193+ // materialized in an on-chain output, so we wouldn't have anything
194+ // to anchor the asset commitment to.
195+ if htlcAmt < minHtlcAmt {
196+ htlcAmt = minHtlcAmt
197+ }
198+
199199 // If the HTLC carries asset units (keysend, forwarding), then there's
200200 // no need to do any RFQ related math. We can directly compare the asset
201201 // units of the HTLC with those in our local balance.
0 commit comments