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:
57 files changed
+512
-299
No files matched your search
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/clock"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/graph"
|
||||
graphdb "github.com/lightningnetwork/lnd/graph/db"
|
||||
"github.com/lightningnetwork/lnd/graph/db/models"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
@@ -68,7 +69,7 @@ type testCtx struct {
|
||||
|
||||
graphBuilder *mockGraphBuilder
|
||||
|
||||
graph *channeldb.ChannelGraph
|
||||
graph *graphdb.ChannelGraph
|
||||
|
||||
aliases map[string]route.Vertex
|
||||
|
||||
@@ -191,7 +192,7 @@ func createTestCtxFromGraphInstanceAssumeValid(t *testing.T,
|
||||
return ctx
|
||||
}
|
||||
|
||||
func createTestNode() (*channeldb.LightningNode, error) {
|
||||
func createTestNode() (*graphdb.LightningNode, error) {
|
||||
updateTime := rand.Int63()
|
||||
|
||||
priv, err := btcec.NewPrivateKey()
|
||||
@@ -200,7 +201,7 @@ func createTestNode() (*channeldb.LightningNode, error) {
|
||||
}
|
||||
|
||||
pub := priv.PubKey().SerializeCompressed()
|
||||
n := &channeldb.LightningNode{
|
||||
n := &graphdb.LightningNode{
|
||||
HaveNodeAnnouncement: true,
|
||||
LastUpdate: time.Unix(updateTime, 0),
|
||||
Addresses: testAddrs,
|
||||
@@ -2898,7 +2899,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
|
||||
|
||||
// Now check that we can update the node info for the partial node
|
||||
// without messing up the channel graph.
|
||||
n1 := &channeldb.LightningNode{
|
||||
n1 := &graphdb.LightningNode{
|
||||
HaveNodeAnnouncement: true,
|
||||
LastUpdate: time.Unix(123, 0),
|
||||
Addresses: testAddrs,
|
||||
@@ -2911,7 +2912,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
|
||||
|
||||
require.NoError(t, ctx.graph.AddLightningNode(n1))
|
||||
|
||||
n2 := &channeldb.LightningNode{
|
||||
n2 := &graphdb.LightningNode{
|
||||
HaveNodeAnnouncement: true,
|
||||
LastUpdate: time.Unix(123, 0),
|
||||
Addresses: testAddrs,
|
||||
|
||||
Reference in new issue
Block a user