This issue aims to track a set of improvements that we want to make to LND in the long haul. In general this involves adding more abstractions and making things more modular so that:
1) there is more clear ownership of what a sub-system owns
2) more abstractions means that LND can be "pieced" together: for example we could spin up a new LND node, turn off it's gossiper and point it's ChannelRouter to an existing, fully populated channel graph source.
LND Today
DB: the node's channel state data is stored in the same DB as the network graph data
Gossiper: the gossiper handles both network announcements from peers but then also special cases certain announcements relevant to the node it belongs to. It does some announcement validation & then sends the announcements to the Router to handle further.
The Router then further validates the announcements, handles topology change notifications and writes the announcements to the graph.
The Vision
A complete separation between the Gossiper and the Router.
Router only has read access through a very small interface to a Graph source. And it essentially can become completely node agnostic.
Gossiper does all announcement validation and is the only thing writing to the graph DB.
Local Chans Announcement manager has it's own DB for it's channel state and channel announcements.
With the following vision, LND really only needs the following pieces on startup (from the sub-systems we are referring to here that is):
a Local Announcement Manager which we will provide with a BroadcastAnnouncements call which may be backed by it's own gossiper or another node's gossiper.
a Router which we will provide with a RoutingGraph interface which could be backed by a different node's channel graph.
The following 2 steps seem to be good starting points:
1) Just ensuring that the pathfinding logic in the Router only has access to an abstracted, read only routing graph. Along with this, we can abstract out the additionalEdges and bandwidthManager inputs so that those are provided via an interface or via call-backs in the pathfinding request.
2) removing announcement validation, pruning and topology subscription from the router
This issue aims to track a set of improvements that we want to make to LND in the long haul. In general this involves adding more abstractions and making things more modular so that:
1) there is more clear ownership of what a sub-system owns 2) more abstractions means that LND can be "pieced" together: for example we could spin up a new LND node, turn off it's gossiper and point it's ChannelRouter to an existing, fully populated channel graph source.
LND Today
The Vision
With the following vision, LND really only needs the following pieces on startup (from the sub-systems we are referring to here that is):
Local Announcement Manager
which we will provide with aBroadcastAnnouncements
call which may be backed by it's own gossiper or another node's gossiper.Router
which we will provide with aRoutingGraph
interface which could be backed by a different node's channel graph.Related Issue: https://github.com/lightningnetwork/lnd/issues/6294
What's next?
The following 2 steps seem to be good starting points: 1) Just ensuring that the pathfinding logic in the Router only has access to an abstracted, read only routing graph. Along with this, we can abstract out the
additionalEdges
andbandwidthManager
inputs so that those are provided via an interface or via call-backs in the pathfinding request. 2) removing announcement validation, pruning and topology subscription from the router