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:
András Bánki-Horváth
2023-10-11 13:42:59 +02:00
committed by GitHub
parent 9478b85e59
commit ad5cd9c8bb
18 changed files with 458 additions and 328 deletions

View File

@@ -2,6 +2,7 @@ package contractcourt
import (
"bytes"
"context"
"errors"
"fmt"
"math"
@@ -1885,7 +1886,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(context.Background(), hash)
switch err {
case nil:
case invoices.ErrInvoiceNotFound, invoices.ErrNoInvoicesCreated: