mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-28 05:57:50 +02:00
htlcswitch: modify the InvoiceDatabase interface to allow specifying final payment amt
In this commit, we modify the InvoiceDatabase slightly to allow the link to record what the final payment about for an invoice was. It may be the case that the invoice actually had no specified value, or that the payer paid more than necessary. As a result, it's important that our on-disk records properly reflect this. To fix this issue, the SettleInvoice method now also accepts the final amount paid. Fixes #856.
This commit is contained in:
@@ -673,7 +673,9 @@ func (i *mockInvoiceRegistry) LookupInvoice(rHash chainhash.Hash) (channeldb.Inv
|
||||
return invoice, i.finalDelta, nil
|
||||
}
|
||||
|
||||
func (i *mockInvoiceRegistry) SettleInvoice(rhash chainhash.Hash) error {
|
||||
func (i *mockInvoiceRegistry) SettleInvoice(rhash chainhash.Hash,
|
||||
amt lnwire.MilliSatoshi) error {
|
||||
|
||||
i.Lock()
|
||||
defer i.Unlock()
|
||||
|
||||
@@ -687,6 +689,7 @@ func (i *mockInvoiceRegistry) SettleInvoice(rhash chainhash.Hash) error {
|
||||
}
|
||||
|
||||
invoice.Terms.Settled = true
|
||||
invoice.AmtPaid = amt
|
||||
i.invoices[rhash] = invoice
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user