diff --git a/config_builder.go b/config_builder.go index 6f427ffd2..cf227c0e6 100644 --- a/config_builder.go +++ b/config_builder.go @@ -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( diff --git a/server.go b/server.go index 4da9eb6fb..6a6183c1b 100644 --- a/server.go +++ b/server.go @@ -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)