lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.56k stars 2.06k forks source link

[epic]: ChannelDB, Graph, Gossiper and Router separation #8833

Open ellemouton opened 3 weeks ago

ellemouton commented 3 weeks ago

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

lnd-today drawio

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):

lnd-vision drawio

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 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