refactor: move graph related DB code to graph/db from channeldb

This is a pure refactor commit. It moves over all the graph related CRUD
code from `channeldb` to `graph/db`.
This commit is contained in:
Elle Mouton
2024-10-22 13:35:23 +02:00
parent 9f54ec90aa
commit 74a4b1922b
57 changed files with 512 additions and 299 deletions

View File

@@ -2,8 +2,8 @@ package routing
import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/fn"
graphdb "github.com/lightningnetwork/lnd/graph/db"
"github.com/lightningnetwork/lnd/graph/db/models"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing/route"
@@ -24,7 +24,7 @@ type SessionSource struct {
GraphSessionFactory GraphSessionFactory
// SourceNode is the graph's source node.
SourceNode *channeldb.LightningNode
SourceNode *graphdb.LightningNode
// GetLink is a method that allows querying the lower link layer
// to determine the up to date available bandwidth at a prospective link
@@ -101,7 +101,7 @@ func RouteHintsToEdges(routeHints [][]zpay32.HopHint, target route.Vertex) (
// we'll need to look at the next hint's start node. If
// we've reached the end of the hints list, we can
// assume we've reached the destination.
endNode := &channeldb.LightningNode{}
endNode := &graphdb.LightningNode{}
if i != len(routeHint)-1 {
endNode.AddPubKey(routeHint[i+1].NodeID)
} else {