htlcswitch: abtract invoice from link
This commit detaches signaling the invoice registry that an htlc was locked in from the actually settling of the htlc. It is a preparation for hodl invoices.
This commit is contained in:
6 files changed
+162
-98
No files matched your search
@@ -178,8 +178,10 @@ func (h *htlcSuccessResolver) Resolve() (ContractResolver, error) {
|
||||
}
|
||||
|
||||
// With the HTLC claimed, we can attempt to settle its
|
||||
// corresponding invoice if we were the original destination.
|
||||
err = h.Registry.SettleInvoice(h.payHash, h.htlcAmt)
|
||||
// corresponding invoice if we were the original destination. As
|
||||
// the htlc is already settled at this point, we don't need to
|
||||
// process the result.
|
||||
_, err = h.Registry.NotifyExitHopHtlc(h.payHash, h.htlcAmt)
|
||||
if err != nil && err != channeldb.ErrInvoiceNotFound {
|
||||
log.Errorf("Unable to settle invoice with payment "+
|
||||
"hash %x: %v", h.payHash, err)
|
||||
@@ -251,8 +253,9 @@ func (h *htlcSuccessResolver) Resolve() (ContractResolver, error) {
|
||||
}
|
||||
|
||||
// With the HTLC claimed, we can attempt to settle its corresponding
|
||||
// invoice if we were the original destination.
|
||||
err = h.Registry.SettleInvoice(h.payHash, h.htlcAmt)
|
||||
// invoice if we were the original destination. As the htlc is already
|
||||
// settled at this point, we don't need to read the result.
|
||||
_, err = h.Registry.NotifyExitHopHtlc(h.payHash, h.htlcAmt)
|
||||
if err != nil && err != channeldb.ErrInvoiceNotFound {
|
||||
log.Errorf("Unable to settle invoice with payment "+
|
||||
"hash %x: %v", h.payHash, err)
|
||||
|
||||
Reference in new issue
Block a user