What changed, and why it matters
This commit is a simple, mechanical rename of the graph database interface from V1Store to Store across the codebase. It changes no behavior, logic, or data handling. There is no security relevance.
No action needed. This is a non-security refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit renames the graph/db.V1Store interface to graph/db.Store and updates all references, type assertions, comments, and test helpers accordingly. The diff is purely a symbol rename with identical semantics. No functional code, schema, or security boundary changed.
Changed components
graph/db/interfaces.gograph/db/graph.gograph/db/kv_store.gograph/db/sql_store.goconfig_builder.gograph/db/benchmark_test.gograph/db/graph_test.gograph/db/test_kvdb.gograph/db/test_postgres.gograph/db/test_sqlite.goitest/lnd_graph_migration_test.goInspect captured patch +111 / −111
diff --git a/config_builder.go b/config_builder.go
index 7ce6304..3fe62cd 100644
--- a/config_builder.go
+++ b/config_builder.go
@@ -1096,7 +1096,7 @@ func (d *DefaultDatabaseBuilder) BuildDatabase(
// The graph store implementation we will use depends on whether
// native SQL is enabled or not.
- var graphStore graphdb.V1Store
+ var graphStore graphdb.Store
// Instantiate a native SQL store if the flag is set.
if d.cfg.DB.UseNativeSQL {
diff --git a/graph/db/benchmark_test.go b/graph/db/benchmark_test.go
index 4c9aef7..d7cc3fb 100644
--- a/graph/db/benchmark_test.go
+++ b/graph/db/benchmark_test.go
@@ -72,19 +72,19 @@ var (
// and a function to open the connection.
type dbConnection struct {
name string
- open func(testing.TB) V1Store
+ open func(testing.TB) Store
}
// This var block defines the various database connections that we will use
// for testing. Each connection is defined as a dbConnection struct that
// contains a name and an open function. The open function is used to create
-// a new V1Store instance for the given database type.
+// a new Store instance for the given database type.
var (
// kvdbBBoltConn is a connection to a kvdb-bbolt database called
// channel.db.
kvdbBBoltConn = dbConnection{
name: "kvdb-bbolt",
- open: func(b testing.TB) V1Store {
+ open: func(b testing.TB) Store {
return connectBBoltDB(b, bboltDBPath, kvdbBBoltFile)
},
}
@@ -93,7 +93,7 @@ var (
// channel.sqlite.
kvdbSqliteConn = dbConnection{
name: "kvdb-sqlite",
- open: func(b testing.TB) V1Store {
+ open: func(b testing.TB) Store {
return connectKVDBSqlite(
b, kvdbSqlitePath, kvdbSqliteFile,
)
@@ -104,7 +104,7 @@ var (
// called lnd.sqlite.
nativeSQLSqliteConn = dbConnection{
name: "native-sqlite",
- open: func(b testing.TB) V1Store {
+ open: func(b testing.TB) Store {
return connectNativeSQLite(
b, sqldb.DefaultSQLiteConfig(),
nativeSQLSqlitePath, nativeSQLSqliteFile,
@@ -116,7 +116,7 @@ var (
// using a postgres connection string.
kvdbPostgresConn = dbConnection{
name: "kvdb-postgres",
- open: func(b testing.TB) V1Store {
+ open: func(b testing.TB) Store {
return connectKVDBPostgres(b, kvdbPostgresDNS)
},
}
@@ -125,7 +125,7 @@ var (
// database using a postgres connection string.
nativeSQLPostgresConn = dbConnection{
name: "native-postgres",
- open: func(b testing.TB) V1Store {
+ open: func(b testing.TB) Store {
return connectNativePostgres(
b, sqldb.DefaultPostgresConfig(),
nativeSQLPostgresDNS,
@@ -134,10 +134,10 @@ var (
}
)
-// connectNativePostgres creates a V1Store instance backed by a native Postgres
+// connectNativePostgres creates a Store instance backed by a native Postgres
// database for testing purposes.
func connectNativePostgres(t testing.TB, cfg *sqldb.QueryConfig,
- dsn string) V1Store {
+ dsn string) Store {
return newSQLStore(t, cfg, sqlPostgres(t, dsn))
}
@@ -157,10 +157,10 @@ func sqlPostgres(t testing.TB, dsn string) BatchedSQLQueries {
return newSQLExecutor(t, store)
}
-// connectNativeSQLite creates a V1Store instance backed by a native SQLite
+// connectNativeSQLite creates a Store instance backed by a native SQLite
// database for testing purposes.
func connectNativeSQLite(t testing.TB, cfg *sqldb.QueryConfig, dbPath,
- file string) V1Store {
+ file string) Store {
return newSQLStore(t, cfg, sqlSQLite(t, dbPath, file))
}
@@ -205,9 +205,9 @@ func kvdbPostgres(t testing.TB, dsn string) kvdb.Backend {
return kvStore
}
-// connectKVDBPostgres creates a V1Store instance backed by a kvdb-postgres
+// connectKVDBPostgres creates a Store instance backed by a kvdb-postgres
// database for testing purposes.
-func connectKVDBPostgres(t testing.TB, dsn string) V1Store {
+func connectKVDBPostgres(t testing.TB, dsn string) Store {
return newKVStore(t, kvdbPostgres(t, dsn))
}
@@ -231,14 +231,14 @@ func kvdbSqlite(t testing.TB, dbPath, fileName string) kvdb.Backend {
return kvStore
}
-// connectKVDBSqlite creates a V1Store instance backed by a kvdb-sqlite
+// connectKVDBSqlite creates a Store instance backed by a kvdb-sqlite
// database for testing purposes.
-func connectKVDBSqlite(t testing.TB, dbPath, fileName string) V1Store {
+func connectKVDBSqlite(t testing.TB, dbPath, fileName string) Store {
return newKVStore(t, kvdbSqlite(t, dbPath, fileName))
}
// connectBBoltDB creates a new BBolt database connection for testing.
-func connectBBoltDB(t testing.TB, dbPath, fileName string) V1Store {
+func connectBBoltDB(t testing.TB, dbPath, fileName string) Store {
return newKVStore(t, kvdbBBolt(t, dbPath, fileName))
}
@@ -261,7 +261,7 @@ func kvdbBBolt(t testing.TB, dbPath, fileName string) kvdb.Backend {
// newKVStore creates a new KVStore instance for testing using a provided
// kvdb.Backend instance.
-func newKVStore(t testing.TB, backend kvdb.Backend) V1Store {
+func newKVStore(t testing.TB, backend kvdb.Backend) Store {
store, err := NewKVStore(backend, testStoreOptions...)
require.NoError(t, err)
@@ -286,7 +286,7 @@ func newSQLExecutor(t testing.TB, db sqldb.DB) BatchedSQLQueries {
// newSQLStore creates a new SQLStore instance for testing using a provided
// sqldb.DB instance.
func newSQLStore(t testing.TB, cfg *sqldb.QueryConfig,
- db BatchedSQLQueries) V1Store {
+ db BatchedSQLQueries) Store {
store, err := NewSQLStore(
&SQLStoreConfig{
@@ -587,7 +587,7 @@ func BenchmarkCacheLoading(b *testing.B) {
}
}
-// BenchmarkGraphReadMethods benchmarks various read calls of various V1Store
+// BenchmarkGraphReadMethods benchmarks various read calls of various Store
// implementations.
//
// NOTE: this is to be run against a local graph database. It can be run
@@ -614,11 +614,11 @@ func BenchmarkGraphReadMethods(b *testing.B) {
tests := []struct {
name string
- fn func(b testing.TB, store V1Store)
+ fn func(b testing.TB, store Store)
}{
{
name: "ForEachNode",
- fn: func(b testing.TB, store V1Store) {
+ fn: func(b testing.TB, store Store) {
err := store.ForEachNode(
ctx,
func(_ *models.Node) error {
@@ -635,7 +635,7 @@ func BenchmarkGraphReadMethods(b *testing.B) {
},
{
name: "ForEachChannel",
- fn: func(b testing.TB, store V1Store) {
+ fn: func(b testing.TB, store Store) {
//nolint:ll
err := store.ForEachChannel(
ctx, func(_ *models.ChannelEdgeInfo,
@@ -655,7 +655,7 @@ func BenchmarkGraphReadMethods(b *testing.B) {
},
{
name: "NodeUpdatesInHorizon",
- fn: func(b testing.TB, store V1Store) {
+ fn: func(b testing.TB, store Store) {
iter := store.NodeUpdatesInHorizon(
time.Unix(0, 0), time.Now(),
)
@@ -665,7 +665,7 @@ func BenchmarkGraphReadMethods(b *testing.B) {
},
{
name: "ForEachNodeCacheable",
- fn: func(b testing.TB, store V1Store) {
+ fn: func(b testing.TB, store Store) {
err := store.ForEachNodeCacheable(
ctx, func(_ route.Vertex,
_ *lnwire.FeatureVector) error {
@@ -683,7 +683,7 @@ func BenchmarkGraphReadMethods(b *testing.B) {
},
{
name: "ForEachNodeCached",
- fn: func(b testing.TB, store V1Store) {
+ fn: func(b testing.TB, store Store) {
//nolint:ll
err := store.ForEachNodeCached(
ctx, false, func(context.Context,
@@ -704,7 +704,7 @@ func BenchmarkGraphReadMethods(b *testing.B) {
},
{
name: "ChanUpdatesInHorizon",
- fn: func(b testing.TB, store V1Store) {
+ fn: func(b testing.TB, store Store) {
iter := store.ChanUpdatesInHorizon(
time.Unix(0, 0), time.Now(),
)
diff --git a/graph/db/graph.go b/graph/db/graph.go
index fc1ffa3..37aad6a 100644
--- a/graph/db/graph.go
+++ b/graph/db/graph.go
@@ -30,7 +30,7 @@ type ChannelGraph struct {
graphCache *GraphCache
- V1Store
+ Store
*topologyManager
quit chan struct{}
@@ -38,7 +38,7 @@ type ChannelGraph struct {
}
// NewChannelGraph creates a new ChannelGraph instance with the given backend.
-func NewChannelGraph(v1Store V1Store,
+func NewChannelGraph(v1Store Store,
options ...ChanGraphOption) (*ChannelGraph, error) {
opts := defaultChanGraphOptions()
@@ -47,7 +47,7 @@ func NewChannelGraph(v1Store V1Store,
}
g := &ChannelGraph{
- V1Store: v1Store,
+ Store: v1Store,
topologyManager: newTopologyManager(),
quit: make(chan struct{}),
}
@@ -161,7 +161,7 @@ func (c *ChannelGraph) populateCache(ctx context.Context) error {
log.Info("Populating in-memory channel graph, this might take a " +
"while...")
- err := c.V1Store.ForEachNodeCacheable(ctx, func(node route.Vertex,
+ err := c.Store.ForEachNodeCacheable(ctx, func(node route.Vertex,
features *lnwire.FeatureVector) error {
c.graphCache.AddNodeFeatures(node, features)
@@ -172,7 +172,7 @@ func (c *ChannelGraph) populateCache(ctx context.Context) error {
return err
}
- err = c.V1Store.ForEachChannelCacheable(
+ err = c.Store.ForEachChannelCacheable(
func(info *models.CachedEdgeInfo,
policy1, policy2 *models.CachedEdgePolicy) error {
@@ -208,7 +208,7 @@ func (c *ChannelGraph) ForEachNodeDirectedChannel(node route.Vertex,
return c.graphCache.ForEachChannel(node, cb)
}
- return c.V1Store.ForEachNodeDirectedChannel(node, cb, reset)
+ return c.Store.ForEachNodeDirectedChannel(node, cb, reset)
}
// FetchNodeFeatures returns the features of the given node. If no features are
@@ -224,7 +224,7 @@ func (c *ChannelGraph) FetchNodeFeatures(node route.Vertex) (
return c.graphCache.GetFeatures(node), nil
}
- return c.V1Store.FetchNodeFeatures(node)
+ return c.Store.FetchNodeFeatures(node)
}
// GraphSession will provide the call-back with access to a NodeTraverser
@@ -238,7 +238,7 @@ func (c *ChannelGraph) GraphSession(cb func(graph NodeTraverser) error,
return cb(c)
}
- return c.V1Store.GraphSession(cb, reset)
+ return c.Store.GraphSession(cb, reset)
}
// ForEachNodeCached iterates through all the stored vertices/nodes in the
@@ -259,7 +259,7 @@ func (c *ChannelGraph) ForEachNodeCached(ctx context.Context, withAddrs bool,
)
}
- return c.V1Store.ForEachNodeCached(ctx, withAddrs, cb, reset)
+ return c.Store.ForEachNodeCached(ctx, withAddrs, cb, reset)
}
// AddNode adds a vertex/node to the graph database. If the node is not
@@ -271,7 +271,7 @@ func (c *ChannelGraph) ForEachNodeCached(ctx context.Context, withAddrs bool,
func (c *ChannelGraph) AddNode(ctx context.Context,
node *models.Node, op ...batch.SchedulerOption) error {
- err := c.V1Store.AddNode(ctx, node, op...)
+ err := c.Store.AddNode(ctx, node, op...)
if err != nil {
return err
}
@@ -296,7 +296,7 @@ func (c *ChannelGraph) AddNode(ctx context.Context,
func (c *ChannelGraph) DeleteNode(ctx context.Context,
nodePub route.Vertex) error {
- err := c.V1Store.DeleteNode(ctx, nodePub)
+ err := c.Store.DeleteNode(ctx, nodePub)
if err != nil {
return err
}
@@ -317,7 +317,7 @@ func (c *ChannelGraph) DeleteNode(ctx context.Context,
func (c *ChannelGraph) AddChannelEdge(ctx context.Context,
edge *models.ChannelEdgeInfo, op ...batch.SchedulerOption) error {
- err := c.V1Store.AddChannelEdge(ctx, edge, op...)
+ err := c.Store.AddChannelEdge(ctx, edge, op...)
if err != nil {
return err
}
@@ -339,7 +339,7 @@ func (c *ChannelGraph) AddChannelEdge(ctx context.Context,
// If the cache is enabled, the edge will be added back to the graph cache if
// we still have a record of this channel in the DB.
func (c *ChannelGraph) MarkEdgeLive(chanID uint64) error {
- err := c.V1Store.MarkEdgeLive(chanID)
+ err := c.Store.MarkEdgeLive(chanID)
if err != nil {
return err
}
@@ -347,7 +347,7 @@ func (c *ChannelGraph) MarkEdgeLive(chanID uint64) error {
if c.graphCache != nil {
// We need to add the channel back into our graph cache,
// otherwise we won't use it for path finding.
- infos, err := c.V1Store.FetchChanInfos([]uint64{chanID})
+ infos, err := c.Store.FetchChanInfos([]uint64{chanID})
if err != nil {
return err
}
@@ -385,7 +385,7 @@ func (c *ChannelGraph) MarkEdgeLive(chanID uint64) error {
func (c *ChannelGraph) DeleteChannelEdges(strictZombiePruning, markZombie bool,
chanIDs ...uint64) error {
- infos, err := c.V1Store.DeleteChannelEdges(
+ infos, err := c.Store.DeleteChannelEdges(
strictZombiePruning, markZombie, chanIDs...,
)
if err != nil {
@@ -414,7 +414,7 @@ func (c *ChannelGraph) DeleteChannelEdges(strictZombiePruning, markZombie bool,
func (c *ChannelGraph) DisconnectBlockAtHeight(height uint32) (
[]*models.ChannelEdgeInfo, error) {
- edges, err := c.V1Store.DisconnectBlockAtHeight(height)
+ edges, err := c.Store.DisconnectBlockAtHeight(height)
if err != nil {
return nil, err
}
@@ -442,7 +442,7 @@ func (c *ChannelGraph) PruneGraph(spentOutputs []*wire.OutPoint,
blockHash *chainhash.Hash, blockHeight uint32) (
[]*models.ChannelEdgeInfo, error) {
- edges, nodes, err := c.V1Store.PruneGraph(
+ edges, nodes, err := c.Store.PruneGraph(
spentOutputs, blockHash, blockHeight,
)
if err != nil {
@@ -487,7 +487,7 @@ func (c *ChannelGraph) PruneGraph(spentOutputs []*wire.OutPoint,
// that we only maintain a graph of reachable nodes. In the event that a pruned
// node gains more channels, it will be re-added back to the graph.
func (c *ChannelGraph) PruneGraphNodes() error {
- nodes, err := c.V1Store.PruneGraphNodes()
+ nodes, err := c.Store.PruneGraphNodes()
if err != nil {
return err
}
@@ -509,7 +509,7 @@ func (c *ChannelGraph) PruneGraphNodes() error {
func (c *ChannelGraph) FilterKnownChanIDs(chansInfo []ChannelUpdateInfo,
isZombieChan func(time.Time, time.Time) bool) ([]uint64, error) {
- unknown, knownZombies, err := c.V1Store.FilterKnownChanIDs(chansInfo)
+ unknown, knownZombies, err := c.Store.FilterKnownChanIDs(chansInfo)
if err != nil {
return nil, err
}
@@ -538,7 +538,7 @@ func (c *ChannelGraph) FilterKnownChanIDs(chansInfo []ChannelUpdateInfo,
// timestamps could bring it back from the dead, then we mark it
// alive, and we let it be added to the set of IDs to query our
// peer for.
- err := c.V1Store.MarkEdgeLive(
+ err := c.Store.MarkEdgeLive(
info.ShortChannelID.ToUint64(),
)
// Since there is a chance that the edge could have been marked
@@ -559,7 +559,7 @@ func (c *ChannelGraph) FilterKnownChanIDs(chansInfo []ChannelUpdateInfo,
func (c *ChannelGraph) MarkEdgeZombie(chanID uint64,
pubKey1, pubKey2 [33]byte) error {
- err := c.V1Store.MarkEdgeZombie(chanID, pubKey1, pubKey2)
+ err := c.Store.MarkEdgeZombie(chanID, pubKey1, pubKey2)
if err != nil {
return err
}
@@ -581,7 +581,7 @@ func (c *ChannelGraph) MarkEdgeZombie(chanID uint64,
func (c *ChannelGraph) UpdateEdgePolicy(ctx context.Context,
edge *models.ChannelEdgePolicy, op ...batch.SchedulerOption) error {
- from, to, err := c.V1Store.UpdateEdgePolicy(ctx, edge, op...)
+ from, to, err := c.Store.UpdateEdgePolicy(ctx, edge, op...)
if err != nil {
return err
}
@@ -602,11 +602,11 @@ func (c *ChannelGraph) UpdateEdgePolicy(ctx context.Context,
}
// MakeTestGraph creates a new instance of the ChannelGraph for testing
-// purposes. The backing V1Store implementation depends on the version of
+// purposes. The backing Store implementation depends on the version of
// NewTestDB included in the current build.
//
// NOTE: this is currently unused, but is left here for future use to show how
-// NewTestDB can be used. As the SQL implementation of the V1Store is
+// NewTestDB can be used. As the SQL implementation of the Store is
// implemented, unit tests will be switched to use this function instead of
// the existing MakeTestGraph helper. Once only this function is used, the
// existing MakeTestGraph function will be removed and this one will be renamed.
diff --git a/graph/db/graph_test.go b/graph/db/graph_test.go
index 3e5c931..5cbd325 100644
--- a/graph/db/graph_test.go
+++ b/graph/db/graph_test.go
@@ -153,7 +153,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
// Check that the node's features are fetched correctly. This check
// will check the database directly.
- features, err = graph.V1Store.FetchNodeFeatures(node.PubKeyBytes)
+ features, err = graph.Store.FetchNodeFeatures(node.PubKeyBytes)
require.NoError(t, err)
require.Equal(t, testFeatures, features)
@@ -1575,7 +1575,7 @@ func TestGraphTraversalCacheable(t *testing.T) {
require.NoError(t, err)
// Now skip the cache and query the DB directly.
- err = graph.V1Store.ForEachNodeDirectedChannel(
+ err = graph.Store.ForEachNodeDirectedChannel(
node, func(d *DirectedChannel) error {
delete(chanIndex2, d.ChannelID)
return nil
@@ -3603,7 +3603,7 @@ func TestChannelEdgePruningUpdateIndexDeletion(t *testing.T) {
graph := MakeTestGraph(t)
// The update index only applies to the bbolt graph.
- boltStore, ok := graph.V1Store.(*KVStore)
+ boltStore, ok := graph.Store.(*KVStore)
if !ok {
t.Skipf("skipping test that is aimed at a bbolt graph DB")
}
@@ -4161,7 +4161,7 @@ func TestEdgePolicyMissingMaxHTLC(t *testing.T) {
graph := MakeTestGraph(t)
// This test currently directly edits the bytes stored in the bbolt DB.
- boltStore, ok := graph.V1Store.(*KVStore)
+ boltStore, ok := graph.Store.(*KVStore)
if !ok {
t.Skipf("skipping test that is aimed at a bbolt graph DB")
}
diff --git a/graph/db/interfaces.go b/graph/db/interfaces.go
index 2d4da91..20408c9 100644
--- a/graph/db/interfaces.go
+++ b/graph/db/interfaces.go
@@ -28,9 +28,9 @@ type NodeTraverser interface {
FetchNodeFeatures(nodePub route.Vertex) (*lnwire.FeatureVector, error)
}
-// V1Store represents the main interface for the channel graph database for all
+// Store represents the main interface for the channel graph database for all
// channels and nodes gossiped via the V1 gossip protocol as defined in BOLT 7.
-type V1Store interface { //nolint:interfacebloat
+type Store interface { //nolint:interfacebloat
NodeTraverser
// AddNode adds a vertex/node to the graph database. If the
diff --git a/graph/db/kv_store.go b/graph/db/kv_store.go
index 34b21c9..27c3bba 100644
--- a/graph/db/kv_store.go
+++ b/graph/db/kv_store.go
@@ -199,8 +199,8 @@ type KVStore struct {
}
// A compile-time assertion to ensure that the KVStore struct implements the
-// V1Store interface.
-var _ V1Store = (*KVStore)(nil)
+// Store interface.
+var _ Store = (*KVStore)(nil)
// NewKVStore allocates a new KVStore backed by a DB instance. The
// returned instance has its own unique reject cache and channel cache.
@@ -804,7 +804,7 @@ func (c *KVStore) DisabledChannelIDs() ([]uint64, error) {
// returns an error, then the transaction is aborted and the iteration stops
// early.
//
-// NOTE: this is part of the V1Store interface.
+// NOTE: this is part of the Store interface.
func (c *KVStore) ForEachNode(_ context.Context,
cb func(*models.Node) error, reset func()) error {
diff --git a/graph/db/sql_store.go b/graph/db/sql_store.go
index 3e2d74d..3e99483 100644
--- a/graph/db/sql_store.go
+++ b/graph/db/sql_store.go
@@ -163,7 +163,7 @@ type BatchedSQLQueries interface {
sqldb.BatchedTx[SQLQueries]
}
-// SQLStore is an implementation of the V1Store interface that uses a SQL
+// SQLStore is an implementation of the Store interface that uses a SQL
// database as the backend.
type SQLStore struct {
cfg *SQLStoreConfig
@@ -183,9 +183,9 @@ type SQLStore struct {
srcNodeMu sync.Mutex
}
-// A compile-time assertion to ensure that SQLStore implements the V1Store
+// A compile-time assertion to ensure that SQLStore implements the Store
// interface.
-var _ V1Store = (*SQLStore)(nil)
+var _ Store = (*SQLStore)(nil)
// SQLStoreConfig holds the configuration for the SQLStore.
type SQLStoreConfig struct {
@@ -235,7 +235,7 @@ func NewSQLStore(cfg *SQLStoreConfig, db BatchedSQLQueries,
// graph. If it is present from before, this will update that node's
// information.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) AddNode(ctx context.Context,
node *models.Node, opts ...batch.SchedulerOption) error {
@@ -265,7 +265,7 @@ func (s *SQLStore) AddNode(ctx context.Context,
// key. If the node isn't found in the database, then ErrGraphNodeNotFound is
// returned.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) FetchNode(ctx context.Context,
pubKey route.Vertex) (*models.Node, error) {
@@ -289,7 +289,7 @@ func (s *SQLStore) FetchNode(ctx context.Context,
// with a true boolean. Otherwise, an empty time.Time is returned with a false
// boolean.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) HasNode(ctx context.Context,
pubKey [33]byte) (time.Time, bool, error) {
@@ -330,7 +330,7 @@ func (s *SQLStore) HasNode(ctx context.Context,
// that the graph DB is aware of. The returned boolean indicates if the
// given node is unknown to the graph DB or not.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) AddrsForNode(ctx context.Context,
nodePub *btcec.PublicKey) (bool, []net.Addr, error) {
@@ -372,7 +372,7 @@ func (s *SQLStore) AddrsForNode(ctx context.Context,
// DeleteNode starts a new database transaction to remove a vertex/node
// from the database according to the node's public key.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) DeleteNode(ctx context.Context,
pubKey route.Vertex) error {
@@ -423,7 +423,7 @@ func (s *SQLStore) FetchNodeFeatures(nodePub route.Vertex) (
// A channel is disabled when two of the associated ChanelEdgePolicies
// have their disabled bit on.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) DisabledChannelIDs() ([]uint64, error) {
var (
ctx = context.TODO()
@@ -450,7 +450,7 @@ func (s *SQLStore) DisabledChannelIDs() ([]uint64, error) {
// LookupAlias attempts to return the alias as advertised by the target node.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) LookupAlias(ctx context.Context,
pub *btcec.PublicKey) (string, error) {
@@ -488,7 +488,7 @@ func (s *SQLStore) LookupAlias(ctx context.Context,
// a path finding algorithm in order to explore the reachability of another
// node based off the source node.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) SourceNode(ctx context.Context) (*models.Node,
error) {
@@ -517,7 +517,7 @@ func (s *SQLStore) SourceNode(ctx context.Context) (*models.Node,
// node is to be used as the center of a star-graph within path finding
// algorithms.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) SetSourceNode(ctx context.Context,
node *models.Node) error {
@@ -562,7 +562,7 @@ func (s *SQLStore) SetSourceNode(ctx context.Context,
// nodes to quickly determine if they have the same set of up to date node
// announcements.
//
-// NOTE: This is part of the V1Store interface.
+// NOTE: This is part of the Store interface.
func (s *SQLStore) NodeUpdatesInHorizon(startTime, endTime time.Time,
opts ...IteratorOption) iter.Seq2[*models.Node, error] {
@@ -671,7 +671,7 @@ func (s *SQLStore) NodeUpdatesInHorizon(startTime, endTime time.Time,
// supports. The chanPoint and chanID are used to uniquely identify the edge
// globally within the database.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) AddChannelEdge(ctx context.Context,
edge *models.ChannelEdgeInfo, opts ...batch.SchedulerOption) error {
@@ -726,7 +726,7 @@ func (s *SQLStore) AddChannelEdge(ctx context.Context,
// This represents the "newest" channel from the PoV of the chain. This method
// can be used by peers to quickly determine if their graphs are in sync.
//
-// NOTE: This is part of the V1Store interface.
+// NOTE: This is part of the Store interface.
func (s *SQLStore) HighestChanID(ctx context.Context) (uint64, error) {
var highestChanID uint64
err := s.db.ExecTx(ctx, sqldb.ReadTxOpt(), func(db SQLQueries) error {
@@ -757,7 +757,7 @@ func (s *SQLStore) HighestChanID(ctx context.Context) (uint64, error) {
// determined by the lexicographical ordering of the identity public keys of the
// nodes on either side of the channel.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) UpdateEdgePolicy(ctx context.Context,
edge *models.ChannelEdgePolicy,
opts ...batch.SchedulerOption) (route.Vertex, route.Vertex, error) {
@@ -855,7 +855,7 @@ func (s *SQLStore) updateEdgeCache(e *models.ChannelEdgePolicy,
// channel's outpoint, whether we have a policy for the channel and the channel
// peer's node information.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) ForEachSourceNodeChannel(ctx context.Context,
cb func(chanPoint wire.OutPoint, havePolicy bool,
otherNode *models.Node) error, reset func()) error {
@@ -914,7 +914,7 @@ func (s *SQLStore) ForEachSourceNodeChannel(ctx context.Context,
// returns an error, then the transaction is aborted and the iteration stops
// early.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) ForEachNode(ctx context.Context,
cb func(node *models.Node) error, reset func()) error {
@@ -982,7 +982,7 @@ func (s *SQLStore) ForEachNodeCacheable(ctx context.Context,
//
// Unknown policies are passed into the callback as nil values.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) ForEachNodeChannel(ctx context.Context, nodePub route.Vertex,
cb func(*models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
*models.ChannelEdgePolicy) error, reset func()) error {
@@ -1099,7 +1099,7 @@ func (s *SQLStore) updateChanCacheBatch(edgesToCache map[uint64]ChannelEdge) {
// 5. Update cache after successful batch
// 6. Repeat with updated pagination cursor until no more results
//
-// NOTE: This is part of the V1Store interface.
+// NOTE: This is part of the Store interface.
func (s *SQLStore) ChanUpdatesInHorizon(startTime, endTime time.Time,
opts ...IteratorOption) iter.Seq2[ChannelEdge, error] {
@@ -1268,7 +1268,7 @@ func (s *SQLStore) ChanUpdatesInHorizon(startTime, endTime time.Time,
// result in an additional round-trip to the database, so it should only be used
// if the addresses are actually needed.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) ForEachNodeCached(ctx context.Context, withAddrs bool,
cb func(ctx context.Context, node route.Vertex, addrs []net.Addr,
chans map[uint64]*DirectedChannel) error, reset func()) error {
@@ -1564,7 +1564,7 @@ func (s *SQLStore) ForEachChannelCacheable(cb func(*models.CachedEdgeInfo,
// for that particular channel edge routing policy will be passed into the
// callback.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) ForEachChannel(ctx context.Context,
cb func(*models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
*models.ChannelEdgePolicy) error, reset func()) error {
@@ -1582,7 +1582,7 @@ func (s *SQLStore) ForEachChannel(ctx context.Context,
// timestamp info of the latest received channel update messages of the channel
// will be included in the response.
//
-// NOTE: This is part of the V1Store interface.
+// NOTE: This is part of the Store interface.
func (s *SQLStore) FilterChannelRange(startHeight, endHeight uint32,
withTimestamps bool) ([]BlockChannelRange, error) {
@@ -1702,7 +1702,7 @@ func (s *SQLStore) FilterChannelRange(startHeight, endHeight uint32,
// zombie. This method is used on an ad-hoc basis, when channels need to be
// marked as zombies outside the normal pruning cycle.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) MarkEdgeZombie(chanID uint64,
pubKey1, pubKey2 [33]byte) error {
@@ -1736,7 +1736,7 @@ func (s *SQLStore) MarkEdgeZombie(chanID uint64,
// MarkEdgeLive clears an edge from our zombie index, deeming it as live.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) MarkEdgeLive(chanID uint64) error {
s.cacheMu.Lock()
defer s.cacheMu.Unlock()
@@ -1787,7 +1787,7 @@ func (s *SQLStore) MarkEdgeLive(chanID uint64) error {
// zombie, then the two node public keys corresponding to this edge are also
// returned.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) IsZombieEdge(chanID uint64) (bool, [33]byte, [33]byte,
error) {
@@ -1830,7 +1830,7 @@ func (s *SQLStore) IsZombieEdge(chanID uint64) (bool, [33]byte, [33]byte,
// NumZombies returns the current number of zombie channels in the graph.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) NumZombies() (uint64, error) {
var (
ctx = context.TODO()
@@ -1865,7 +1865,7 @@ func (s *SQLStore) NumZombies() (uint64, error) {
// that resurrects the channel from its zombie state. The markZombie bool
// denotes whether to mark the channel as a zombie.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) DeleteChannelEdges(strictZombiePruning, markZombie bool,
chanIDs ...uint64) ([]*models.ChannelEdgeInfo, error) {
@@ -1970,7 +1970,7 @@ func (s *SQLStore) DeleteChannelEdges(strictZombiePruning, markZombie bool,
// within the database. In this case, the ChannelEdgePolicy's will be nil, and
// the ChannelEdgeInfo will only include the public keys of each node.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) FetchChannelEdgesByID(chanID uint64) (
*models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
*models.ChannelEdgePolicy, error) {
@@ -2067,7 +2067,7 @@ func (s *SQLStore) FetchChannelEdgesByID(chanID uint64) (
// information for the channel itself is returned as well as two structs that
// contain the routing policies for the channel in either direction.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) FetchChannelEdgesByOutpoint(op *wire.OutPoint) (
*models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
*models.ChannelEdgePolicy, error) {
@@ -2137,7 +2137,7 @@ func (s *SQLStore) FetchChannelEdgesByOutpoint(op *wire.OutPoint) (
// it is not found, then the zombie index is checked and its result is returned
// as the second boolean.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) HasChannelEdge(chanID uint64) (time.Time, time.Time, bool,
bool, error) {
@@ -2253,7 +2253,7 @@ func (s *SQLStore) HasChannelEdge(chanID uint64) (time.Time, time.Time, bool,
// passed channel point (outpoint). If the passed channel doesn't exist within
// the database, then ErrEdgeNotFound is returned.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) ChannelID(chanPoint *wire.OutPoint) (uint64, error) {
var (
ctx = context.TODO()
@@ -2288,7 +2288,7 @@ func (s *SQLStore) ChannelID(chanPoint *wire.OutPoint) (uint64, error) {
// given public key is seen as a public node in the graph from the graph's
// source node's point of view.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) IsPublicNode(pubKey [33]byte) (bool, error) {
ctx := context.TODO()
@@ -2313,7 +2313,7 @@ func (s *SQLStore) IsPublicNode(pubKey [33]byte) (bool, error) {
// of the query. This can be used to respond to peer queries that are seeking to
// fill in gaps in their view of the channel graph.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) FetchChanInfos(chanIDs []uint64) ([]ChannelEdge, error) {
var (
ctx = context.TODO()
@@ -2407,7 +2407,7 @@ func (s *SQLStore) forEachChanWithPoliciesInSCIDList(ctx context.Context,
// channels another peer knows of that we don't. The ChannelUpdateInfos for the
// known zombies is also returned.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) FilterKnownChanIDs(chansInfo []ChannelUpdateInfo) ([]uint64,
[]ChannelUpdateInfo, error) {
@@ -2531,7 +2531,7 @@ func (s *SQLStore) forEachChanInSCIDList(ctx context.Context, db SQLQueries,
// NOTE: this prunes nodes across protocol versions. It will never prune the
// source nodes.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) PruneGraphNodes() ([]route.Vertex, error) {
var ctx = context.TODO()
@@ -2560,7 +2560,7 @@ func (s *SQLStore) PruneGraphNodes() ([]route.Vertex, error) {
// the target block along with any pruned nodes are returned if the function
// succeeds without error.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) PruneGraph(spentOutputs []*wire.OutPoint,
blockHash *chainhash.Hash, blockHeight uint32) (
[]*models.ChannelEdgeInfo, []route.Vertex, error) {
@@ -2715,7 +2715,7 @@ func (s *SQLStore) deleteChannels(ctx context.Context, db SQLQueries,
// returned are the ones that need to be watched on chain to detect channel
// closes on the resident blockchain.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) ChannelView() ([]EdgePoint, error) {
var (
ctx = context.TODO()
@@ -2781,7 +2781,7 @@ func (s *SQLStore) ChannelView() ([]EdgePoint, error) {
// to tell if the graph is currently in sync with the current best known UTXO
// state.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) PruneTip() (*chainhash.Hash, uint32, error) {
var (
ctx = context.TODO()
@@ -2843,7 +2843,7 @@ func (s *SQLStore) pruneGraphNodes(ctx context.Context,
// Channels that were removed from the graph resulting from the
// disconnected block are returned.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) DisconnectBlockAtHeight(height uint32) (
[]*models.ChannelEdgeInfo, error) {
@@ -2931,7 +2931,7 @@ func (s *SQLStore) DisconnectBlockAtHeight(height uint32) (
// AddEdgeProof sets the proof of an existing edge in the graph database.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) AddEdgeProof(scid lnwire.ShortChannelID,
proof *models.ChannelAuthProof) error {
@@ -2981,7 +2981,7 @@ func (s *SQLStore) AddEdgeProof(scid lnwire.ShortChannelID,
// that we can ignore channel announcements that we know to be closed without
// having to validate them and fetch a block.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) PutClosedScid(scid lnwire.ShortChannelID) error {
var (
ctx = context.TODO()
@@ -2996,7 +2996,7 @@ func (s *SQLStore) PutClosedScid(scid lnwire.ShortChannelID) error {
// IsClosedScid checks whether a channel identified by the passed in scid is
// closed. This helps avoid having to perform expensive validation checks.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) IsClosedScid(scid lnwire.ShortChannelID) (bool, error) {
var (
ctx = context.TODO()
@@ -3024,7 +3024,7 @@ func (s *SQLStore) IsClosedScid(scid lnwire.ShortChannelID) (bool, error) {
// GraphSession will provide the call-back with access to a NodeTraverser
// instance which can be used to perform queries against the channel graph.
//
-// NOTE: part of the V1Store interface.
+// NOTE: part of the Store interface.
func (s *SQLStore) GraphSession(cb func(graph NodeTraverser) error,
reset func()) error {
diff --git a/graph/db/test_kvdb.go b/graph/db/test_kvdb.go
index f325d41..569e094 100644
--- a/graph/db/test_kvdb.go
+++ b/graph/db/test_kvdb.go
@@ -10,7 +10,7 @@ import (
)
// NewTestDB is a helper function that creates an BBolt database for testing.
-func NewTestDB(t testing.TB) V1Store {
+func NewTestDB(t testing.TB) Store {
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
require.NoError(t, err)
diff --git a/graph/db/test_postgres.go b/graph/db/test_postgres.go
index 6134f01..716210a 100644
--- a/graph/db/test_postgres.go
+++ b/graph/db/test_postgres.go
@@ -13,7 +13,7 @@ import (
// NewTestDB is a helper function that creates a SQLStore backed by a SQL
// database for testing.
-func NewTestDB(t testing.TB) V1Store {
+func NewTestDB(t testing.TB) Store {
return NewTestDBWithFixture(t, nil)
}
@@ -31,7 +31,7 @@ func NewTestDBFixture(t *testing.T) *sqldb.TestPgFixture {
// NewTestDBWithFixture is a helper function that creates a SQLStore backed by a
// SQL database for testing.
func NewTestDBWithFixture(t testing.TB,
- pgFixture *sqldb.TestPgFixture) V1Store {
+ pgFixture *sqldb.TestPgFixture) Store {
var querier BatchedSQLQueries
if pgFixture == nil {
diff --git a/graph/db/test_sqlite.go b/graph/db/test_sqlite.go
index c1c6d80..68fef6e 100644
--- a/graph/db/test_sqlite.go
+++ b/graph/db/test_sqlite.go
@@ -13,7 +13,7 @@ import (
// NewTestDB is a helper function that creates a SQLStore backed by a SQL
// database for testing.
-func NewTestDB(t testing.TB) V1Store {
+func NewTestDB(t testing.TB) Store {
return NewTestDBWithFixture(t, nil)
}
@@ -24,7 +24,7 @@ func NewTestDBFixture(_ *testing.T) *sqldb.TestPgFixture {
// NewTestDBWithFixture is a helper function that creates a SQLStore backed by a
// SQL database for testing.
-func NewTestDBWithFixture(t testing.TB, _ *sqldb.TestPgFixture) V1Store {
+func NewTestDBWithFixture(t testing.TB, _ *sqldb.TestPgFixture) Store {
store, err := NewSQLStore(
&SQLStoreConfig{
ChainHash: *chaincfg.MainNetParams.GenesisHash,
diff --git a/itest/lnd_graph_migration_test.go b/itest/lnd_graph_migration_test.go
index 81fe65e..d4a17a4 100644
--- a/itest/lnd_graph_migration_test.go
+++ b/itest/lnd_graph_migration_test.go
@@ -60,7 +60,7 @@ func testGraphMigration(ht *lntest.HarnessTest) {
// assertDBState is a helper function that asserts the state of the
// graph DB.
- assertDBState := func(db graphdb.V1Store) {
+ assertDBState := func(db graphdb.Store) {
var (
numNodes int
edges = make(map[uint64]bool)
@@ -127,7 +127,7 @@ func testGraphMigration(ht *lntest.HarnessTest) {
}
func openNativeSQLGraphDB(ht *lntest.HarnessTest,
- hn *node.HarnessNode) graphdb.V1Store {
+ hn *node.HarnessNode) graphdb.Store {
db := openNativeSQLDB(ht, hn)
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.