Skip to content

Commit 2bc9042

Browse files
committed
lnd: introduce separate payment db on the server level.
1 parent d5e6ee5 commit 2bc9042

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

config_builder.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,10 @@ type DatabaseInstances struct {
924924
// InvoiceDB is the database that stores information about invoices.
925925
InvoiceDB invoices.InvoiceDB
926926

927+
// KVPaymentsDB is the database that stores all payment related
928+
// information.
929+
KVPaymentsDB *channeldb.KVPaymentsDB
930+
927931
// MacaroonDB is the database that stores macaroon root keys.
928932
MacaroonDB kvdb.Backend
929933

@@ -1184,6 +1188,14 @@ func (d *DefaultDatabaseBuilder) BuildDatabase(
11841188
dbs.InvoiceDB = dbs.ChanStateDB
11851189
}
11861190

1191+
// Mount the payments DB which is only KV for now.
1192+
//
1193+
// TODO(ziggie): Add support for SQL payments DB.
1194+
kvPaymentsDB := channeldb.NewKVPaymentsDB(
1195+
dbs.ChanStateDB,
1196+
)
1197+
dbs.KVPaymentsDB = kvPaymentsDB
1198+
11871199
// Wrap the watchtower client DB and make sure we clean up.
11881200
if cfg.WtClient.Active {
11891201
dbs.TowerClientDB, err = wtdb.OpenClientDB(

server.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ type server struct {
317317

318318
invoicesDB invoices.InvoiceDB
319319

320+
// kvPaymentsDB is the DB that contains all functions for managing
321+
// payments.
322+
//
323+
// TODO(ziggie): Replace with interface.
324+
kvPaymentsDB *channeldb.KVPaymentsDB
325+
320326
aliasMgr *aliasmgr.Manager
321327

322328
htlcSwitch *htlcswitch.Switch

0 commit comments

Comments
 (0)