What changed, and why it matters
This is a small internal refactoring change. It swaps out a specific database type for a narrower interface in a few RPC configuration structs. There is no user-facing behavior change, no bug fix, and no security-relevant change visible in the diff.
No security action required. Treat as routine code hygiene / refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit replaces concrete *channeldb.ChannelStateDB fields with chanstate.OpenChannelStore (and chanstate.Store in wiring) in the invoices and wallet RPC subserver configs. This is an interface-dependency refactor to reduce coupling. The affected RPC paths only use channel-state store methods for hop hints and waiting-close queries. No logic, validation, or access-control changes are present.
Changed components
lnrpc/invoicesrpc/addinvoice.golnrpc/invoicesrpc/config_active.golnrpc/walletrpc/config_active.gosubrpcserver_config.goInspect captured patch +12 / −12
diff --git a/lnrpc/invoicesrpc/addinvoice.go b/lnrpc/invoicesrpc/addinvoice.go
index 9afba76..b4d39a9 100644
--- a/lnrpc/invoicesrpc/addinvoice.go
+++ b/lnrpc/invoicesrpc/addinvoice.go
@@ -18,6 +18,7 @@ import (
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/graph/db/models"
"github.com/lightningnetwork/lnd/invoices"
"github.com/lightningnetwork/lnd/lntypes"
@@ -70,9 +71,8 @@ type AddInvoiceConfig struct {
// specified.
DefaultCLTVExpiry uint32
- // ChanDB is a global boltdb instance which is needed to access the
- // channel graph.
- ChanDB *channeldb.ChannelStateDB
+ // ChanDB is used to access open channel state.
+ ChanDB chanstate.OpenChannelStore
// Graph gives the invoice server access to various graph related
// queries.
diff --git a/lnrpc/invoicesrpc/config_active.go b/lnrpc/invoicesrpc/config_active.go
index f2d2b04..233aa59 100644
--- a/lnrpc/invoicesrpc/config_active.go
+++ b/lnrpc/invoicesrpc/config_active.go
@@ -5,7 +5,7 @@ package invoicesrpc
import (
"github.com/btcsuite/btcd/chaincfg"
- "github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/invoices"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/macaroons"
@@ -55,9 +55,9 @@ type Config struct {
// graph.
Graph GraphSource
- // ChanStateDB is a possibly replicated db instance which contains the
- // channel state
- ChanStateDB *channeldb.ChannelStateDB
+ // ChanStateDB is a possibly replicated db instance which contains open
+ // channel state.
+ ChanStateDB chanstate.OpenChannelStore
// GenInvoiceFeatures returns a feature containing feature bits that
// should be advertised on freshly generated invoices.
diff --git a/lnrpc/walletrpc/config_active.go b/lnrpc/walletrpc/config_active.go
index 4636473..e0c9c68 100644
--- a/lnrpc/walletrpc/config_active.go
+++ b/lnrpc/walletrpc/config_active.go
@@ -6,7 +6,7 @@ package walletrpc
import (
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcwallet/wallet"
- "github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
@@ -78,6 +78,6 @@ type Config struct {
// coins when funding a transaction.
CoinSelectionStrategy wallet.CoinSelectionStrategy
- // ChanStateDB is the reference to the channel db.
- ChanStateDB *channeldb.ChannelStateDB
+ // ChanStateDB is the reference to the open channel store.
+ ChanStateDB chanstate.OpenChannelStore
}
diff --git a/subrpcserver_config.go b/subrpcserver_config.go
index 8b3641d..856553c 100644
--- a/subrpcserver_config.go
+++ b/subrpcserver_config.go
@@ -11,7 +11,7 @@ import (
"github.com/lightningnetwork/lnd/aliasmgr"
"github.com/lightningnetwork/lnd/autopilot"
"github.com/lightningnetwork/lnd/chainreg"
- "github.com/lightningnetwork/lnd/channeldb"
+ "github.com/lightningnetwork/lnd/chanstate"
"github.com/lightningnetwork/lnd/fn/v2"
graphdb "github.com/lightningnetwork/lnd/graph/db"
"github.com/lightningnetwork/lnd/htlcswitch"
@@ -115,7 +115,7 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config,
routerBackend *routerrpc.RouterBackend,
nodeSigner *netann.NodeSigner,
graphDB *graphdb.ChannelGraph,
- chanStateDB *channeldb.ChannelStateDB,
+ chanStateDB chanstate.Store,
sweeper *sweep.UtxoSweeper,
tower *watchtower.Standalone,
towerClientMgr *wtclient.Manager,
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.