graph/db: remove KVStore fall-back

Now that SQLStore fully implements V1Store, we no longer need the
KVStore fall-back.
This commit is contained in:
Elle Mouton
2025-06-11 18:17:10 +02:00
parent 3ccaacd16f
commit b4b1c4bd8d
4 changed files with 4 additions and 26 deletions

View File

@@ -91,6 +91,7 @@ circuit. The indices are only available for forwarding events saved after v0.20.
* [8](https://github.com/lightningnetwork/lnd/pull/9938) * [8](https://github.com/lightningnetwork/lnd/pull/9938)
* [9](https://github.com/lightningnetwork/lnd/pull/9939) * [9](https://github.com/lightningnetwork/lnd/pull/9939)
* [10](https://github.com/lightningnetwork/lnd/pull/9971) * [10](https://github.com/lightningnetwork/lnd/pull/9971)
* [11](https://github.com/lightningnetwork/lnd/pull/9972)
## RPC Updates ## RPC Updates

View File

@@ -175,10 +175,6 @@ type SQLStore struct {
srcNodes map[ProtocolVersion]*srcNodeInfo srcNodes map[ProtocolVersion]*srcNodeInfo
srcNodeMu sync.Mutex srcNodeMu sync.Mutex
// Temporary fall-back to the KVStore so that we can implement the
// interface incrementally.
*KVStore
} }
// A compile-time assertion to ensure that SQLStore implements the V1Store // A compile-time assertion to ensure that SQLStore implements the V1Store
@@ -194,7 +190,7 @@ type SQLStoreConfig struct {
// NewSQLStore creates a new SQLStore instance given an open BatchedSQLQueries // NewSQLStore creates a new SQLStore instance given an open BatchedSQLQueries
// storage backend. // storage backend.
func NewSQLStore(cfg *SQLStoreConfig, db BatchedSQLQueries, kvStore *KVStore, func NewSQLStore(cfg *SQLStoreConfig, db BatchedSQLQueries,
options ...StoreOptionModifier) (*SQLStore, error) { options ...StoreOptionModifier) (*SQLStore, error) {
opts := DefaultOptions() opts := DefaultOptions()
@@ -210,7 +206,6 @@ func NewSQLStore(cfg *SQLStoreConfig, db BatchedSQLQueries, kvStore *KVStore,
s := &SQLStore{ s := &SQLStore{
cfg: cfg, cfg: cfg,
db: db, db: db,
KVStore: kvStore,
rejectCache: newRejectCache(opts.RejectCacheSize), rejectCache: newRejectCache(opts.RejectCacheSize),
chanCache: newChannelCache(opts.ChannelCacheSize), chanCache: newChannelCache(opts.ChannelCacheSize),
srcNodes: make(map[ProtocolVersion]*srcNodeInfo), srcNodes: make(map[ProtocolVersion]*srcNodeInfo),

View File

@@ -7,7 +7,6 @@ import (
"testing" "testing"
"github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg"
"github.com/lightningnetwork/lnd/kvdb"
"github.com/lightningnetwork/lnd/sqldb" "github.com/lightningnetwork/lnd/sqldb"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@@ -16,14 +15,6 @@ import (
// database for testing. At the moment, it embeds a KVStore but once the // database for testing. At the moment, it embeds a KVStore but once the
// SQLStore fully implements the V1Store interface, the KVStore will be removed. // SQLStore fully implements the V1Store interface, the KVStore will be removed.
func NewTestDB(t testing.TB) V1Store { func NewTestDB(t testing.TB) V1Store {
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
require.NoError(t, err)
t.Cleanup(backendCleanup)
graphStore, err := NewKVStore(backend)
require.NoError(t, err)
pgFixture := sqldb.NewTestPgFixture( pgFixture := sqldb.NewTestPgFixture(
t, sqldb.DefaultPostgresFixtureLifetime, t, sqldb.DefaultPostgresFixtureLifetime,
) )
@@ -42,7 +33,7 @@ func NewTestDB(t testing.TB) V1Store {
store, err := NewSQLStore( store, err := NewSQLStore(
&SQLStoreConfig{ &SQLStoreConfig{
ChainHash: *chaincfg.MainNetParams.GenesisHash, ChainHash: *chaincfg.MainNetParams.GenesisHash,
}, executor, graphStore, }, executor,
) )
require.NoError(t, err) require.NoError(t, err)

View File

@@ -7,7 +7,6 @@ import (
"testing" "testing"
"github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg"
"github.com/lightningnetwork/lnd/kvdb"
"github.com/lightningnetwork/lnd/sqldb" "github.com/lightningnetwork/lnd/sqldb"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@@ -16,14 +15,6 @@ import (
// database for testing. At the moment, it embeds a KVStore but once the // database for testing. At the moment, it embeds a KVStore but once the
// SQLStore fully implements the V1Store interface, the KVStore will be removed. // SQLStore fully implements the V1Store interface, the KVStore will be removed.
func NewTestDB(t testing.TB) V1Store { func NewTestDB(t testing.TB) V1Store {
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
require.NoError(t, err)
t.Cleanup(backendCleanup)
graphStore, err := NewKVStore(backend)
require.NoError(t, err)
db := sqldb.NewTestSqliteDB(t).BaseDB db := sqldb.NewTestSqliteDB(t).BaseDB
executor := sqldb.NewTransactionExecutor( executor := sqldb.NewTransactionExecutor(
@@ -35,7 +26,7 @@ func NewTestDB(t testing.TB) V1Store {
store, err := NewSQLStore( store, err := NewSQLStore(
&SQLStoreConfig{ &SQLStoreConfig{
ChainHash: *chaincfg.MainNetParams.GenesisHash, ChainHash: *chaincfg.MainNetParams.GenesisHash,
}, executor, graphStore, }, executor,
) )
require.NoError(t, err) require.NoError(t, err)