mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
config: expose the InvoiceDB
interface in DatabaseInstances
By now the only implementation is still the one in channeldb but other project can use their custom implementations if needed.
This commit is contained in:
parent
5ff5225245
commit
824e792dc2
@ -25,6 +25,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/blockcache"
|
||||
"github.com/lightningnetwork/lnd/chainreg"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/invoices"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/lncfg"
|
||||
@ -764,6 +765,9 @@ type DatabaseInstances struct {
|
||||
// HeightHintDB is the database that stores height hints for spends.
|
||||
HeightHintDB kvdb.Backend
|
||||
|
||||
// InvoiceDB is the database that stores information about invoices.
|
||||
InvoiceDB invoices.InvoiceDB
|
||||
|
||||
// MacaroonDB is the database that stores macaroon root keys.
|
||||
MacaroonDB kvdb.Backend
|
||||
|
||||
@ -915,6 +919,12 @@ func (d *DefaultDatabaseBuilder) BuildDatabase(
|
||||
// using the same struct (and DB backend) instance.
|
||||
dbs.ChanStateDB = dbs.GraphDB
|
||||
|
||||
// For now the only InvoiceDB implementation is the *channeldb.DB.
|
||||
//
|
||||
// TODO(positiveblue): use a sql first implementation for this
|
||||
// interface.
|
||||
dbs.InvoiceDB = dbs.GraphDB
|
||||
|
||||
// Wrap the watchtower client DB and make sure we clean up.
|
||||
if cfg.WtClient.Active {
|
||||
dbs.TowerClientDB, err = wtdb.OpenClientDB(
|
||||
|
@ -614,7 +614,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
uint32(currentHeight), currentHash, cc.ChainNotifier,
|
||||
)
|
||||
s.invoices = invoices.NewRegistry(
|
||||
dbs.ChanStateDB, expiryWatcher, ®istryConfig,
|
||||
dbs.InvoiceDB, expiryWatcher, ®istryConfig,
|
||||
)
|
||||
|
||||
s.htlcNotifier = htlcswitch.NewHtlcNotifier(time.Now)
|
||||
|
Loading…
Reference in New Issue
Block a user