mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-26 01:33:02 +01:00
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.
This commit is contained in:
parent
0839d4ba7b
commit
5e3ef3ec0c
@ -1576,13 +1576,6 @@ func fetchInvoiceData(ctx context.Context, db SQLInvoiceQueries,
|
||||
|
||||
if len(htlcs) > 0 {
|
||||
invoice.Htlcs = htlcs
|
||||
var amountPaid lnwire.MilliSatoshi
|
||||
for _, htlc := range htlcs {
|
||||
if htlc.State == HtlcStateSettled {
|
||||
amountPaid += htlc.Amt
|
||||
}
|
||||
}
|
||||
invoice.AmtPaid = amountPaid
|
||||
}
|
||||
|
||||
return hash, invoice, nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user