lnd.xprv/discovery
Wilmer Paulino a188657b2f
discovery: introduce gossiper SyncManager subsystem
In this commit, we introduce a new subsystem for the gossiper: the
SyncManager. This subsystem is a major overhaul on the way the daemon
performs the graph query sync state machine with peers.

Along with this subsystem, we also introduce the concept of an active
syncer. An active syncer is simply a GossipSyncer currently operating
under an ActiveSync sync type. Before this commit, all GossipSyncer's
would act as active syncers, which means that we were receiving new
graph updates from all of them. This isn't necessary, as it greatly
increases bandwidth usage as the network grows. The SyncManager changes
this by requiring a specific number of active syncers. Once we reach
this specified number, any future peers will have a GossipSyncer with a
PassiveSync sync type.

It is responsible for three main things:

1. Choosing different peers randomly to receive graph updates from to
ensure we don't only receive them from the same set of peers.

2. Choosing different peers to force a historical sync with to ensure we
have as much of the public network as possible. The first syncer
registered with the manager will also attempt a historical sync.

3. Managing an in-order queue of active syncers where the next cannot be
started until the current one has completed its state machine to ensure
they don't overlap and request the same set of channels, which
significantly reduces bandwidth usage and addresses a number of issues.
2019-04-03 15:08:32 -07:00
..
bootstrapper.go discovery: update autopilot.Node usage to match recent API changes 2018-08-29 15:45:39 -07:00
chan_series.go discovery/chan_series+utils: include max htlc when syncing with peers 2019-01-22 08:42:28 +01:00
gossiper_test.go discovery: check if stale within isMsgStale for ChannelUpdate messages 2019-03-28 17:22:23 -07:00
gossiper.go discovery: replace GossipSyncer syncChanUpdates flag with SyncerType 2019-04-03 15:08:27 -07:00
log.go multi: init subsystem loggers via build pkg 2018-10-05 13:04:45 +09:00
message_store_test.go discovery/message_store: add gossip message store 2019-02-14 18:29:39 -08:00
message_store.go discovery/message_store: add gossip message store 2019-02-14 18:29:39 -08:00
mock_test.go peer: add SendMessageLazy 2019-03-05 17:08:22 -08:00
reliable_sender_test.go discovery: replace waitPredicate with lntest version 2019-04-03 15:08:12 -07:00
reliable_sender.go discovery: add missing offline peer check before sending message reliably 2019-03-28 17:21:28 -07:00
sync_manager_test.go discovery: introduce gossiper SyncManager subsystem 2019-04-03 15:08:32 -07:00
sync_manager.go discovery: introduce gossiper SyncManager subsystem 2019-04-03 15:08:32 -07:00
syncer_test.go discovery: introduce GossipSyncer signal delivery of chansSynced state 2019-04-03 15:08:31 -07:00
syncer.go discovery: introduce GossipSyncer signal delivery of chansSynced state 2019-04-03 15:08:31 -07:00
utils.go discovery/chan_series+utils: include max htlc when syncing with peers 2019-01-22 08:42:28 +01:00