Skip to content

Commit b4b1c4b

Browse files
committed
graph/db: remove KVStore fall-back
Now that SQLStore fully implements V1Store, we no longer need the KVStore fall-back.
1 parent 3ccaacd commit b4b1c4b

File tree

4 files changed

+4
-26
lines changed

4 files changed

+4
-26
lines changed

docs/release-notes/release-notes-0.20.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ circuit. The indices are only available for forwarding events saved after v0.20.
9191
* [8](https://github.com/lightningnetwork/lnd/pull/9938)
9292
* [9](https://github.com/lightningnetwork/lnd/pull/9939)
9393
* [10](https://github.com/lightningnetwork/lnd/pull/9971)
94+
* [11](https://github.com/lightningnetwork/lnd/pull/9972)
9495

9596
## RPC Updates
9697

graph/db/sql_store.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ type SQLStore struct {
175175

176176
srcNodes map[ProtocolVersion]*srcNodeInfo
177177
srcNodeMu sync.Mutex
178-
179-
// Temporary fall-back to the KVStore so that we can implement the
180-
// interface incrementally.
181-
*KVStore
182178
}
183179

184180
// A compile-time assertion to ensure that SQLStore implements the V1Store
@@ -194,7 +190,7 @@ type SQLStoreConfig struct {
194190

195191
// NewSQLStore creates a new SQLStore instance given an open BatchedSQLQueries
196192
// storage backend.
197-
func NewSQLStore(cfg *SQLStoreConfig, db BatchedSQLQueries, kvStore *KVStore,
193+
func NewSQLStore(cfg *SQLStoreConfig, db BatchedSQLQueries,
198194
options ...StoreOptionModifier) (*SQLStore, error) {
199195

200196
opts := DefaultOptions()
@@ -210,7 +206,6 @@ func NewSQLStore(cfg *SQLStoreConfig, db BatchedSQLQueries, kvStore *KVStore,
210206
s := &SQLStore{
211207
cfg: cfg,
212208
db: db,
213-
KVStore: kvStore,
214209
rejectCache: newRejectCache(opts.RejectCacheSize),
215210
chanCache: newChannelCache(opts.ChannelCacheSize),
216211
srcNodes: make(map[ProtocolVersion]*srcNodeInfo),

graph/db/test_postgres.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"testing"
88

99
"github.com/btcsuite/btcd/chaincfg"
10-
"github.com/lightningnetwork/lnd/kvdb"
1110
"github.com/lightningnetwork/lnd/sqldb"
1211
"github.com/stretchr/testify/require"
1312
)
@@ -16,14 +15,6 @@ import (
1615
// database for testing. At the moment, it embeds a KVStore but once the
1716
// SQLStore fully implements the V1Store interface, the KVStore will be removed.
1817
func NewTestDB(t testing.TB) V1Store {
19-
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
20-
require.NoError(t, err)
21-
22-
t.Cleanup(backendCleanup)
23-
24-
graphStore, err := NewKVStore(backend)
25-
require.NoError(t, err)
26-
2718
pgFixture := sqldb.NewTestPgFixture(
2819
t, sqldb.DefaultPostgresFixtureLifetime,
2920
)
@@ -42,7 +33,7 @@ func NewTestDB(t testing.TB) V1Store {
4233
store, err := NewSQLStore(
4334
&SQLStoreConfig{
4435
ChainHash: *chaincfg.MainNetParams.GenesisHash,
45-
}, executor, graphStore,
36+
}, executor,
4637
)
4738
require.NoError(t, err)
4839

graph/db/test_sqlite.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"testing"
88

99
"github.com/btcsuite/btcd/chaincfg"
10-
"github.com/lightningnetwork/lnd/kvdb"
1110
"github.com/lightningnetwork/lnd/sqldb"
1211
"github.com/stretchr/testify/require"
1312
)
@@ -16,14 +15,6 @@ import (
1615
// database for testing. At the moment, it embeds a KVStore but once the
1716
// SQLStore fully implements the V1Store interface, the KVStore will be removed.
1817
func NewTestDB(t testing.TB) V1Store {
19-
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
20-
require.NoError(t, err)
21-
22-
t.Cleanup(backendCleanup)
23-
24-
graphStore, err := NewKVStore(backend)
25-
require.NoError(t, err)
26-
2718
db := sqldb.NewTestSqliteDB(t).BaseDB
2819

2920
executor := sqldb.NewTransactionExecutor(
@@ -35,7 +26,7 @@ func NewTestDB(t testing.TB) V1Store {
3526
store, err := NewSQLStore(
3627
&SQLStoreConfig{
3728
ChainHash: *chaincfg.MainNetParams.GenesisHash,
38-
}, executor, graphStore,
29+
}, executor,
3930
)
4031
require.NoError(t, err)
4132

0 commit comments

Comments
 (0)