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 committed 2024-11-28 13:36:13 +02:00
1 parent 9f54ec90aa
commit 74a4b1922b
57 files changed
+512 -299

No files matched your search

+6 -5
View File
@@ -43,6 +43,7 @@ import (
"github.com/lightningnetwork/lnd/fn"
"github.com/lightningnetwork/lnd/funding"
"github.com/lightningnetwork/lnd/graph"
graphdb "github.com/lightningnetwork/lnd/graph/db"
"github.com/lightningnetwork/lnd/graph/db/models"
"github.com/lightningnetwork/lnd/healthcheck"
"github.com/lightningnetwork/lnd/htlcswitch"
@@ -258,7 +259,7 @@ type server struct {
fundingMgr *funding.Manager
graphDB *channeldb.ChannelGraph
graphDB *graphdb.ChannelGraph
chanStateDB *channeldb.ChannelStateDB
@@ -878,7 +879,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
if err != nil {
return nil, err
}
selfNode := &channeldb.LightningNode{
selfNode := &graphdb.LightningNode{
HaveNodeAnnouncement: true,
LastUpdate: time.Now(),
Addresses: selfAddrs,
@@ -1389,7 +1390,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
info, e1, e2, err := s.graphDB.FetchChannelEdgesByID(
scid.ToUint64(),
)
if errors.Is(err, channeldb.ErrEdgeNotFound) {
if errors.Is(err, graphdb.ErrEdgeNotFound) {
// This is unlikely but there is a slim chance of this
// being hit if lnd was killed via SIGKILL and the
// funding manager was stepping through the delete
@@ -3185,7 +3186,7 @@ func (s *server) createNewHiddenService() error {
// Finally, we'll update the on-disk version of our announcement so it
// will eventually propagate to nodes in the network.
selfNode := &channeldb.LightningNode{
selfNode := &graphdb.LightningNode{
HaveNodeAnnouncement: true,
LastUpdate: time.Unix(int64(newNodeAnn.Timestamp), 0),
Addresses: newNodeAnn.Addresses,
@@ -3448,7 +3449,7 @@ func (s *server) establishPersistentConnections() error {
nodeAddrsMap[pubStr] = n
return nil
})
if err != nil && err != channeldb.ErrGraphNoEdgesFound {
if err != nil && err != graphdb.ErrGraphNoEdgesFound {
return err
}