mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-11 01:11:02 +02:00
channeldb: remove kvdb.Backend from LightningNode
Now that the kvdb.Backend is no longer required, it is removed from the LightningNode struct.
This commit is contained in:
parent
d37f5d7e1a
commit
6d878c65fc
@ -682,7 +682,6 @@ func (c *ChannelGraph) ForEachNode(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
node.db = c.db
|
|
||||||
|
|
||||||
// Execute the callback, the transaction will abort if
|
// Execute the callback, the transaction will abort if
|
||||||
// this returns an error.
|
// this returns an error.
|
||||||
@ -780,7 +779,6 @@ func (c *ChannelGraph) sourceNode(nodes kvdb.RBucket) (*LightningNode, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
node.db = c.db
|
|
||||||
|
|
||||||
return &node, nil
|
return &node, nil
|
||||||
}
|
}
|
||||||
@ -2038,7 +2036,6 @@ func (c *ChannelGraph) NodeUpdatesInHorizon(startTime,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
node.db = c.db
|
|
||||||
|
|
||||||
nodesInHorizon = append(nodesInHorizon, node)
|
nodesInHorizon = append(nodesInHorizon, node)
|
||||||
}
|
}
|
||||||
@ -2660,8 +2657,6 @@ type LightningNode struct {
|
|||||||
// compatible manner.
|
// compatible manner.
|
||||||
ExtraOpaqueData []byte
|
ExtraOpaqueData []byte
|
||||||
|
|
||||||
db kvdb.Backend
|
|
||||||
|
|
||||||
// TODO(roasbeef): discovery will need storage to keep it's last IP
|
// TODO(roasbeef): discovery will need storage to keep it's last IP
|
||||||
// address and re-announce if interface changes?
|
// address and re-announce if interface changes?
|
||||||
|
|
||||||
@ -2813,7 +2808,6 @@ func (c *ChannelGraph) FetchLightningNode(nodePub route.Vertex) (
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
n.db = c.db
|
|
||||||
|
|
||||||
node = &n
|
node = &n
|
||||||
|
|
||||||
@ -3239,7 +3233,6 @@ func (c *ChannelEdgeInfo) FetchOtherNode(tx kvdb.RTx,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
node.db = c.db
|
|
||||||
|
|
||||||
targetNode = &node
|
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.
|
// only fill in the database pointers if the edge is found.
|
||||||
if edge1 != nil {
|
if edge1 != nil {
|
||||||
edge1.db = db
|
edge1.db = db
|
||||||
edge1.Node.db = db
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Similarly, the second node is contained within the latter
|
// Similarly, the second node is contained within the latter
|
||||||
@ -4655,7 +4647,6 @@ func fetchChanEdgePolicies(edgeIndex kvdb.RBucket, edges kvdb.RBucket,
|
|||||||
|
|
||||||
if edge2 != nil {
|
if edge2 != nil {
|
||||||
edge2.db = db
|
edge2.db = db
|
||||||
edge2.Node.db = db
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return edge1, edge2, nil
|
return edge1, edge2, nil
|
||||||
|
@ -95,7 +95,6 @@ func createLightningNode(db kvdb.Backend, priv *btcec.PrivateKey) (*LightningNod
|
|||||||
Alias: "kek" + string(pub[:]),
|
Alias: "kek" + string(pub[:]),
|
||||||
Features: testFeatures,
|
Features: testFeatures,
|
||||||
Addresses: testAddrs,
|
Addresses: testAddrs,
|
||||||
db: db,
|
|
||||||
}
|
}
|
||||||
copy(n.PubKeyBytes[:], priv.PubKey().SerializeCompressed())
|
copy(n.PubKeyBytes[:], priv.PubKey().SerializeCompressed())
|
||||||
|
|
||||||
@ -129,7 +128,6 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
|
|||||||
Addresses: testAddrs,
|
Addresses: testAddrs,
|
||||||
ExtraOpaqueData: []byte("extra new data"),
|
ExtraOpaqueData: []byte("extra new data"),
|
||||||
PubKeyBytes: testPub,
|
PubKeyBytes: testPub,
|
||||||
db: graph.db,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// First, insert the node into the graph DB. This should succeed
|
// First, insert the node into the graph DB. This should succeed
|
||||||
@ -207,7 +205,6 @@ func TestPartialNode(t *testing.T) {
|
|||||||
HaveNodeAnnouncement: false,
|
HaveNodeAnnouncement: false,
|
||||||
LastUpdate: time.Unix(0, 0),
|
LastUpdate: time.Unix(0, 0),
|
||||||
PubKeyBytes: testPub,
|
PubKeyBytes: testPub,
|
||||||
db: graph.db,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := compareNodes(node, dbNode); err != nil {
|
if err := compareNodes(node, dbNode); err != nil {
|
||||||
@ -2713,7 +2710,6 @@ func TestNodeIsPublic(t *testing.T) {
|
|||||||
graphs := []*ChannelGraph{aliceGraph, bobGraph, carolGraph}
|
graphs := []*ChannelGraph{aliceGraph, bobGraph, carolGraph}
|
||||||
for i, graph := range graphs {
|
for i, graph := range graphs {
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
node.db = dbs[i]
|
|
||||||
if err := graph.AddLightningNode(node); err != nil {
|
if err := graph.AddLightningNode(node); err != nil {
|
||||||
t.Fatalf("unable to add node: %v", err)
|
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 "+
|
return fmt.Errorf("Alias doesn't match: expected %#v, \n "+
|
||||||
"got %#v", a.Alias, b.Alias)
|
"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) {
|
if !reflect.DeepEqual(a.HaveNodeAnnouncement, b.HaveNodeAnnouncement) {
|
||||||
return fmt.Errorf("HaveNodeAnnouncement doesn't match: expected %#v, \n "+
|
return fmt.Errorf("HaveNodeAnnouncement doesn't match: expected %#v, \n "+
|
||||||
"got %#v", a.HaveNodeAnnouncement, b.HaveNodeAnnouncement)
|
"got %#v", a.HaveNodeAnnouncement, b.HaveNodeAnnouncement)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user