diff --git a/channeldb/graph.go b/channeldb/graph.go index 00be88d18..ac40830e6 100644 --- a/channeldb/graph.go +++ b/channeldb/graph.go @@ -682,7 +682,6 @@ func (c *ChannelGraph) ForEachNode( if err != nil { return err } - node.db = c.db // Execute the callback, the transaction will abort if // this returns an error. @@ -780,7 +779,6 @@ func (c *ChannelGraph) sourceNode(nodes kvdb.RBucket) (*LightningNode, error) { if err != nil { return nil, err } - node.db = c.db return &node, nil } @@ -2038,7 +2036,6 @@ func (c *ChannelGraph) NodeUpdatesInHorizon(startTime, if err != nil { return err } - node.db = c.db nodesInHorizon = append(nodesInHorizon, node) } @@ -2660,8 +2657,6 @@ type LightningNode struct { // compatible manner. ExtraOpaqueData []byte - db kvdb.Backend - // TODO(roasbeef): discovery will need storage to keep it's last IP // address and re-announce if interface changes? @@ -2813,7 +2808,6 @@ func (c *ChannelGraph) FetchLightningNode(nodePub route.Vertex) ( if err != nil { return err } - n.db = c.db node = &n @@ -3239,7 +3233,6 @@ func (c *ChannelEdgeInfo) FetchOtherNode(tx kvdb.RTx, if err != nil { return err } - node.db = c.db targetNode = &node @@ -4642,7 +4635,6 @@ func fetchChanEdgePolicies(edgeIndex kvdb.RBucket, edges kvdb.RBucket, // only fill in the database pointers if the edge is found. if edge1 != nil { edge1.db = db - edge1.Node.db = db } // Similarly, the second node is contained within the latter @@ -4655,7 +4647,6 @@ func fetchChanEdgePolicies(edgeIndex kvdb.RBucket, edges kvdb.RBucket, if edge2 != nil { edge2.db = db - edge2.Node.db = db } return edge1, edge2, nil diff --git a/channeldb/graph_test.go b/channeldb/graph_test.go index 1455763a7..0e13e915d 100644 --- a/channeldb/graph_test.go +++ b/channeldb/graph_test.go @@ -95,7 +95,6 @@ func createLightningNode(db kvdb.Backend, priv *btcec.PrivateKey) (*LightningNod Alias: "kek" + string(pub[:]), Features: testFeatures, Addresses: testAddrs, - db: db, } copy(n.PubKeyBytes[:], priv.PubKey().SerializeCompressed()) @@ -129,7 +128,6 @@ func TestNodeInsertionAndDeletion(t *testing.T) { Addresses: testAddrs, ExtraOpaqueData: []byte("extra new data"), PubKeyBytes: testPub, - db: graph.db, } // First, insert the node into the graph DB. This should succeed @@ -207,7 +205,6 @@ func TestPartialNode(t *testing.T) { HaveNodeAnnouncement: false, LastUpdate: time.Unix(0, 0), PubKeyBytes: testPub, - db: graph.db, } if err := compareNodes(node, dbNode); err != nil { @@ -2713,7 +2710,6 @@ func TestNodeIsPublic(t *testing.T) { graphs := []*ChannelGraph{aliceGraph, bobGraph, carolGraph} for i, graph := range graphs { for _, node := range nodes { - node.db = dbs[i] if err := graph.AddLightningNode(node); err != nil { t.Fatalf("unable to add node: %v", err) } @@ -3150,10 +3146,6 @@ func compareNodes(a, b *LightningNode) error { return fmt.Errorf("Alias doesn't match: expected %#v, \n "+ "got %#v", a.Alias, b.Alias) } - if !reflect.DeepEqual(a.db, b.db) { - return fmt.Errorf("db doesn't match: expected %#v, \n "+ - "got %#v", a.db, b.db) - } if !reflect.DeepEqual(a.HaveNodeAnnouncement, b.HaveNodeAnnouncement) { return fmt.Errorf("HaveNodeAnnouncement doesn't match: expected %#v, \n "+ "got %#v", a.HaveNodeAnnouncement, b.HaveNodeAnnouncement)