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:
positiveblue committed 2023-01-16 07:31:09 -08:00
1 parent 383cb40f8d
commit 5ff5225245
26 files changed
+2839 -2253

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ import (
type InvoiceDatabase interface {
// LookupInvoice attempts to look up an invoice according to its 32
// byte payment hash.
LookupInvoice(lntypes.Hash) (channeldb.Invoice, error)
LookupInvoice(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