1

Lightning nodes store a full network snapshots to calculate routes for outgoing payments. Nodes listen to announcements of new (public) channel openings and constantly update their local snapshots.

But where do new nodes (or nodes which return after being offline) get the information about the currently existing channels?

2

This is done via the peer 2 peer network that comes along with lightning and is specified in BOLT 07 - routing-gossip. If you read the details you will see that you have to peer to a node in order to maintain a channel. But you could also establish peer2peer connections with other peers without the necessity to maintain a channel.

The peer protocol supports channel announcement messages that are being forwarded via the gossip protocol and query messages to ask for messages if a node connects for the first time to the network or was offline as asked.

  • So new node issues a query message to a neighbor and gets an archive of all past channel announcements in response? There is no guarantee that a remote node has the full picture of the network and doesn't intentionally omit some messages, right? – Sergei Tikhomirov May 8 at 14:40
  • Yes. But as the node can query any peer I believe this ability to censor should not yield a problem – Rene Pickhardt May 8 at 14:43
  • Is this sustainable long-term as the network graph will be getting bigger? – Sergei Tikhomirov May 8 at 15:04
  • 1
    A new node will flag the initial_gossip_sync bit in the local_features of the init message the first time they connect. The connected node will forward all known gossip information in response. Query messages are used later to re-sync if there is some missing information, of if information has been filtered. – Mark H May 8 at 15:26
  • 1
    @MarkH By sustainable I meant that the nodes won't be able to store the whole graph to do proper routing. The question of censorship indeed seems to be solvable by querying multiple peers (unless the node is eclipsed somehow). – Sergei Tikhomirov May 8 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.