Skip to content

Commit 5e3ef3e

Browse files
committed
invoices+sql: use the stored AmtPaid value instead of recalculating
Previously we'd recalculate the paid amount by summing amounts of settled HTLCs. This approach while correct would stop the SQL migration process as some KV invoices may have incorrectly stored paid amounts.
1 parent 0839d4b commit 5e3ef3e

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

invoices/sql_store.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,13 +1576,6 @@ func fetchInvoiceData(ctx context.Context, db SQLInvoiceQueries,
15761576

15771577
if len(htlcs) > 0 {
15781578
invoice.Htlcs = htlcs
1579-
var amountPaid lnwire.MilliSatoshi
1580-
for _, htlc := range htlcs {
1581-
if htlc.State == HtlcStateSettled {
1582-
amountPaid += htlc.Amt
1583-
}
1584-
}
1585-
invoice.AmtPaid = amountPaid
15861579
}
15871580

15881581
return hash, invoice, nil

0 commit comments

Comments
 (0)