graph/db: explicit redirect to Store
Instead of embedding Store in ChannelGraph so that any methods of the Store interface not implemented by the ChannelGraph are redirected to the underlying Store, we update things in this commit to instead make the "redirection" explicit. This is in preparation for changes we will make soon where some underlying store methods will take an explicit "version" parameter but then we will keep the ChannelGraph methods as is so that existing call-sites dont all need to be updated. We will then add "Versioned" ChannelGraph wrapper which decides the version use. Initially, most call-sites will just create a wrapped V1 ChannelGraph so that the logic remains as it is today.
This commit is contained in:
2 files changed
+226
-25
No files matched your search
@@ -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.Store.FetchNodeFeatures(node.PubKeyBytes)
|
||||
features, err = graph.db.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.Store.ForEachNodeDirectedChannel(
|
||||
err = graph.db.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.Store.(*KVStore)
|
||||
boltStore, ok := graph.db.(*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.Store.(*KVStore)
|
||||
boltStore, ok := graph.db.(*KVStore)
|
||||
if !ok {
|
||||
t.Skipf("skipping test that is aimed at a bbolt graph DB")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user