Came up during the development of the invoice migration PR (#8831).
An invoice has an AmtPaid field when represented on disk and also in memory:
|
// AmtPaid is the final amount that we ultimately accepted for pay for |
|
// this invoice. We specify this value independently as it's possible |
|
// that the invoice originally didn't specify an amount, or the sender |
|
// overpaid. |
|
AmtPaid lnwire.MilliSatoshi |
We need to make the description more clear what AmtPaid really means especially when it comes to HoldInvoice which can cancel the HTLC which right now results in the AmtPaid increasing even though the HTLC might have been canceled. So either we clarify the description or we do not increase the Amt if an HTLC is just in the Accepted state.
Example:
"settle_index": "0",
"amt_paid": "100000",
"amt_paid_sat": "100",
"amt_paid_msat": "100000",
"state": "CANCELED",
"htlcs": [
{
"chan_id": "369435906998272",
"htlc_index": "0",
"amt_msat": "100000",
"accept_height": 341,
"accept_time": "1737587642",
"resolve_time": "1737587833",
"expiry_height": 424,
"state": "CANCELED",
"custom_records": {},
"mpp_total_amt_msat": "100000",
"amp": null,
"custom_channel_data": ""
}
],
or in case it was just accepted:
"amt_paid": "100000",
"amt_paid_sat": "100",
"amt_paid_msat": "100000",
"state": "ACCEPTED",
"htlcs": [
{
"chan_id": "369435906998272",
"htlc_index": "0",
"amt_msat": "100000",
"accept_height": 341,
"accept_time": "1737587642",
"resolve_time": "0",
"expiry_height": 424,
"state": "ACCEPTED",
"custom_records": {},
"mpp_total_amt_msat": "100000",
"amp": null,
"custom_channel_data": ""
}
],
Came up during the development of the invoice migration PR (#8831).
An invoice has an
AmtPaidfield when represented on disk and also in memory:lnd/channeldb/migration12/invoices.go
Lines 144 to 148 in 1f20bd3
We need to make the description more clear what
AmtPaidreally means especially when it comes to HoldInvoice which can cancel the HTLC which right now results in the AmtPaid increasing even though the HTLC might have been canceled. So either we clarify the description or we do not increase the Amt if an HTLC is just in theAcceptedstate.Example:
or in case it was just accepted: