htlcswitch: obtain the min final CLTV delta directly from the InvoiceDatabase

In this commit, we modify the existing logic that would attempt to read
the min CLTV information from the invoice directly. With this route, we
avoid any sort of DB index modifications, as this information is already
stored within the payment request, which is already available to the
outside callers. By modifying the InvoiceDatabase interface, we avoid
having to make the switch aware of what the "primary" chain is.
This commit is contained in:
Olaoluwa Osuntokun committed 2018-06-29 16:03:13 -07:00
1 parent c914de177b
commit 2196d9375e
6 files changed
+72 -54

No files matched your search

+4 -2
View File
@@ -11,8 +11,10 @@ import (
// which may search, lookup and settle invoices.
type InvoiceDatabase interface {
// LookupInvoice attempts to look up an invoice according to its 32
// byte payment hash.
LookupInvoice(chainhash.Hash) (channeldb.Invoice, error)
// byte payment hash. This method should also reutrn the min final CLTV
// delta for this invoice. We'll use this to ensure that the HTLC
// extended to us gives us enough time to settle as we prescribe.
LookupInvoice(chainhash.Hash) (channeldb.Invoice, uint32, error)
// SettleInvoice attempts to mark an invoice corresponding to the
// passed payment hash as fully settled.