Skip to content

Commit 6420706

Browse files
committed
tapchannel: fix off-by-1 issue in invoice manager
Due to the new way we calculate asset rates, the rounding works slightly differently. That's why we need to add a single milli-satoshi to the total inbound margin.
1 parent d74dd65 commit 6420706

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tapchannel/aux_invoice_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (s *AuxInvoiceManager) handleInvoiceAccept(_ context.Context,
179179
// If the sum of the accepted HTLCs plus the current HTLC amount plus
180180
// the error margin is greater than the invoice amount, we'll accept it.
181181
totalInbound := acceptedHtlcSum + resp.AmtPaid
182-
totalInboundWithMargin := totalInbound + allowedMarginMSat
182+
totalInboundWithMargin := totalInbound + allowedMarginMSat + 1
183183
invoiceValue := lnwire.MilliSatoshi(req.Invoice.ValueMsat)
184184

185185
log.Debugf("Accepted HTLC sum: %v, current HTLC amount: %v, allowed "+

0 commit comments

Comments
 (0)