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:
Olaoluwa Osuntokun
2018-04-24 20:43:55 -07:00
parent edbdcddea1
commit a32f2b79da
4 changed files with 20 additions and 6 deletions

View File

@@ -3657,6 +3657,13 @@ func TestChannelLinkAcceptOverpay(t *testing.T) {
t.Fatalf("channel bandwidth incorrect: expected %v, got %v",
expectedCarolBandwidth, n.carolChannelLink.Bandwidth())
}
// Finally, we'll ensure that the amount we paid is properly reflected
// in the stored invoice.
if invoice.AmtPaid != amount {
t.Fatalf("expected amt paid to be %v, is instead %v", amount,
invoice.AmtPaid)
}
}
// chanRestoreFunc is a method signature for functions that can reload both