lnd: introduce separate key-value payment db

We also addd this new db on the server level to use it in the
following commit to do all the payment related queries of the
rpcserver.
We add a new payment db instance on the server level. Which we
will you for the payment related queries in a following commit.
This commit is contained in:
ziggie committed 2025-08-02 13:21:48 +02:00
1 parent 84b2a94da2
commit e120110470
2 files changed
+20 -3

No files matched your search

+8 -3
View File
@@ -335,6 +335,12 @@ type server struct {
invoicesDB invoices.InvoiceDB
// kvPaymentsDB is the DB that contains all functions for managing
// payments.
//
// TODO(ziggie): Replace with interface.
kvPaymentsDB *channeldb.KVPaymentsDB
aliasMgr *aliasmgr.Manager
htlcSwitch *htlcswitch.Switch
@@ -678,6 +684,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
addrSource: addrSource,
miscDB: dbs.ChanStateDB,
invoicesDB: dbs.InvoiceDB,
kvPaymentsDB: dbs.KVPaymentsDB,
cc: cc,
sigPool: lnwallet.NewSigPool(cfg.Workers.Sig, cc.Signer),
writePool: writePool,
@@ -1127,9 +1134,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
PathFindingConfig: pathFindingConfig,
}
paymentControl := channeldb.NewKVPaymentsDB(dbs.ChanStateDB)
s.controlTower = routing.NewControlTower(paymentControl)
s.controlTower = routing.NewControlTower(dbs.KVPaymentsDB)
strictPruning := cfg.Bitcoin.Node == "neutrino" ||
cfg.Routing.StrictZombiePruning