multi: extend InvoiceDB methods with a context argument (#8066)
* multi: extend InvoiceDB methods with a context argument This commit adds a context to InvoiceDB's methods. Along this refactor we also extend InvoiceRegistry methods with contexts where it makes sense. This change is essential to be able to provide kvdb and sqldb implementations for InvoiceDB. * channeldb: restrict invoice tests to only use an InvoiceDB instance * docs: update release notes for 0.18.0
This commit is contained in:
1 parent
9478b85e59
commit
ad5cd9c8bb
18 files changed
+458
-328
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package htlcswitch
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/channeldb/models"
|
||||
@@ -17,7 +19,7 @@ import (
|
||||
type InvoiceDatabase interface {
|
||||
// LookupInvoice attempts to look up an invoice according to its 32
|
||||
// byte payment hash.
|
||||
LookupInvoice(lntypes.Hash) (invoices.Invoice, error)
|
||||
LookupInvoice(context.Context, lntypes.Hash) (invoices.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
|
||||
@@ -33,10 +35,10 @@ type InvoiceDatabase interface {
|
||||
|
||||
// CancelInvoice attempts to cancel the invoice corresponding to the
|
||||
// passed payment hash.
|
||||
CancelInvoice(payHash lntypes.Hash) error
|
||||
CancelInvoice(ctx context.Context, payHash lntypes.Hash) error
|
||||
|
||||
// SettleHodlInvoice settles a hold invoice.
|
||||
SettleHodlInvoice(preimage lntypes.Preimage) error
|
||||
SettleHodlInvoice(ctx context.Context, preimage lntypes.Preimage) error
|
||||
|
||||
// HodlUnsubscribeAll unsubscribes from all htlc resolutions.
|
||||
HodlUnsubscribeAll(subscriber chan<- interface{})
|
||||
|
||||
Reference in new issue
Block a user