mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-19 20:15:18 +02:00
multi: use separate cltv expiry field from invoice
Now that the Invoice struct contains the decoded final cltv delta value, the decoding of payment requests can be removed from the invoice registry.
This commit is contained in:
@@ -1348,7 +1348,7 @@ func (c *ChannelArbitrator) isPreimageAvailable(hash lntypes.Hash) (bool,
|
||||
// than the invoice cltv delta. We don't want to go to chain only to
|
||||
// have the incoming contest resolver decide that we don't want to
|
||||
// settle this invoice.
|
||||
invoice, _, err := c.cfg.Registry.LookupInvoice(hash)
|
||||
invoice, err := c.cfg.Registry.LookupInvoice(hash)
|
||||
switch err {
|
||||
case nil:
|
||||
case channeldb.ErrInvoiceNotFound, channeldb.ErrNoInvoicesCreated:
|
||||
|
@@ -10,10 +10,8 @@ import (
|
||||
// Registry is an interface which represents the invoice registry.
|
||||
type Registry interface {
|
||||
// LookupInvoice attempts to look up an invoice according to its 32
|
||||
// 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(lntypes.Hash) (channeldb.Invoice, uint32, error)
|
||||
// byte payment hash.
|
||||
LookupInvoice(lntypes.Hash) (channeldb.Invoice, error)
|
||||
|
||||
// NotifyExitHopHtlc attempts to mark an invoice as settled. If the
|
||||
// invoice is a debug invoice, then this method is a noop as debug
|
||||
|
@@ -39,8 +39,8 @@ func (r *mockRegistry) NotifyExitHopHtlc(payHash lntypes.Hash,
|
||||
|
||||
func (r *mockRegistry) HodlUnsubscribeAll(subscriber chan<- interface{}) {}
|
||||
|
||||
func (r *mockRegistry) LookupInvoice(lntypes.Hash) (channeldb.Invoice, uint32,
|
||||
func (r *mockRegistry) LookupInvoice(lntypes.Hash) (channeldb.Invoice,
|
||||
error) {
|
||||
|
||||
return channeldb.Invoice{}, 0, channeldb.ErrInvoiceNotFound
|
||||
return channeldb.Invoice{}, channeldb.ErrInvoiceNotFound
|
||||
}
|
||||
|
Reference in New Issue
Block a user