multi: remove LightningNode from ChannelEdgePolicy

Finally, The LightningNode object is removed from ChannelEdgePolicy.
This is a step towards letting ChannelEdgePolicy reflect exactly the
schema that is on disk.

This is also nice because the `Node` object is not necessarily always
required when the ChannelEdgePolicy is loaded from the DB, so now it
only get's loaded when needed.
This commit is contained in:
Elle Mouton
2023-10-23 14:39:15 +02:00
parent 6c76d31e89
commit 3a17479ff4
9 changed files with 114 additions and 130 deletions

View File

@@ -104,6 +104,11 @@ func (d *dbNode) ForEachChannel(cb func(ChannelEdge) error) error {
return nil
}
node, err := d.db.FetchLightningNode(tx, ep.ToNode)
if err != nil {
return err
}
edge := ChannelEdge{
ChanID: lnwire.NewShortChanIDFromInt(
ep.ChannelID,
@@ -112,7 +117,7 @@ func (d *dbNode) ForEachChannel(cb func(ChannelEdge) error) error {
Peer: &dbNode{
tx: tx,
db: d.db,
node: ep.Node,
node: node,
},
}