diff --git a/rfq/order.go b/rfq/order.go index 7d29e1709..481fa0efd 100644 --- a/rfq/order.go +++ b/rfq/order.go @@ -297,6 +297,13 @@ func (c *AssetPurchasePolicy) CheckHtlcCompliance( return fmt.Errorf("error summing asset balance: %w", err) } + // Due to rounding errors, we may slightly underreport the incoming + // value of the asset. So we increase it by exactly one asset unit to + // ensure that we do not reject the HTLC in the "inbound amount cannot + // be less than outbound amount" check below. + roundingCorrection := rfqmath.NewBigIntFromUint64(1) + assetAmt = assetAmt.Add(roundingCorrection) + // Convert the inbound asset amount to millisatoshis and ensure that the // outgoing HTLC amount is not more than the inbound asset amount. assetAmtFp := new(rfqmath.BigIntFixedPoint).SetIntValue(assetAmt)