mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-29 18:10:48 +02:00
multi: break invoice depenency on channeldb
Now that we have the new package `lnd/channeldb/models` we can invert the depenency between `channeldb` and `invoices`. - Move all the invoice related types and errors to the `invoices` package. - Ensure that all the packages dealing with invoices use the types and interfaces defined in the `invoices` package. - Implement the InvoiceDB interface (defined in `lnd/invoices`) in channeldb. - Add new mock for InterfaceDB. - `InvoiceRegistery` tests are now in its own subpacakge (they need to import both invoices & channeldb). This is temporary until we can decouple them.
This commit is contained in:
@ -5507,7 +5507,7 @@ func (r *rpcServer) LookupInvoice(ctx context.Context,
|
||||
|
||||
invoice, err := r.server.invoices.LookupInvoice(payHash)
|
||||
switch {
|
||||
case err == channeldb.ErrInvoiceNotFound:
|
||||
case errors.Is(err, invoices.ErrInvoiceNotFound):
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
case err != nil:
|
||||
return nil, err
|
||||
@ -5551,7 +5551,7 @@ func (r *rpcServer) ListInvoices(ctx context.Context,
|
||||
|
||||
// Next, we'll map the proto request into a format that is understood by
|
||||
// the database.
|
||||
q := channeldb.InvoiceQuery{
|
||||
q := invoices.InvoiceQuery{
|
||||
IndexOffset: req.IndexOffset,
|
||||
NumMaxInvoices: req.NumMaxInvoices,
|
||||
PendingOnly: req.PendingOnly,
|
||||
|
Reference in New Issue
Block a user