mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-20 13:04:28 +02:00
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:
@@ -336,7 +336,7 @@ type DB struct {
|
||||
channelStateDB *ChannelStateDB
|
||||
|
||||
dbPath string
|
||||
graph *ChannelGraph
|
||||
graph *graphdb.ChannelGraph
|
||||
clock clock.Clock
|
||||
dryRun bool
|
||||
keepFailedPaymentAttempts bool
|
||||
@@ -410,7 +410,7 @@ func CreateWithBackend(backend kvdb.Backend,
|
||||
chanDB.channelStateDB.parent = chanDB
|
||||
|
||||
var err error
|
||||
chanDB.graph, err = NewChannelGraph(
|
||||
chanDB.graph, err = graphdb.NewChannelGraph(
|
||||
backend, opts.RejectCacheSize, opts.ChannelCacheSize,
|
||||
opts.BatchCommitInterval, opts.PreAllocCacheNumNodes,
|
||||
opts.UseGraphCache, opts.NoMigration,
|
||||
@@ -1370,12 +1370,12 @@ func (d *DB) AddrsForNode(nodePub *btcec.PublicKey) ([]net.Addr,
|
||||
return nil, err
|
||||
}
|
||||
graphNode, err := d.graph.FetchLightningNode(pubKey)
|
||||
if err != nil && err != ErrGraphNodeNotFound {
|
||||
if err != nil && err != graphdb.ErrGraphNodeNotFound {
|
||||
return nil, err
|
||||
} else if err == ErrGraphNodeNotFound {
|
||||
} else if err == graphdb.ErrGraphNodeNotFound {
|
||||
// If the node isn't found, then that's OK, as we still have the
|
||||
// link node data. But any other error needs to be returned.
|
||||
graphNode = &LightningNode{}
|
||||
graphNode = &graphdb.LightningNode{}
|
||||
}
|
||||
|
||||
// Now that we have both sources of addrs for this node, we'll use a
|
||||
@@ -1647,7 +1647,7 @@ func (d *DB) applyOptionalVersions(cfg OptionalMiragtionConfig) error {
|
||||
}
|
||||
|
||||
// ChannelGraph returns the current instance of the directed channel graph.
|
||||
func (d *DB) ChannelGraph() *ChannelGraph {
|
||||
func (d *DB) ChannelGraph() *graphdb.ChannelGraph {
|
||||
return d.graph
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user