channeldb+graphdb: init graph DB outside of channel db

We also now use the graph DB's own optional functions. An instance of
the graph is currently still passed to the channeldb's
`CreateWithBackend` function. This will be removed in a later commit
once the two have been completely disjoint.
This commit is contained in:
Elle Mouton
2024-10-22 13:54:37 +02:00
parent 74a4b1922b
commit 1859993734
11 changed files with 98 additions and 203 deletions

View File

@@ -17,7 +17,6 @@ import (
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
graphdb "github.com/lightningnetwork/lnd/graph/db"
"github.com/lightningnetwork/lnd/graph/db/models"
"github.com/lightningnetwork/lnd/htlcswitch"
@@ -1100,11 +1099,8 @@ func makeTestGraph(t *testing.T, useCache bool) (*graphdb.ChannelGraph,
t.Cleanup(backendCleanup)
opts := channeldb.DefaultOptions()
graph, err := graphdb.NewChannelGraph(
backend, opts.RejectCacheSize, opts.ChannelCacheSize,
opts.BatchCommitInterval, opts.PreAllocCacheNumNodes,
useCache, false,
backend, graphdb.WithUseGraphCache(useCache),
)
if err != nil {
return nil, nil, err