mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
server: if remote peer knows of gossip queries, skip initial table dump
This commit is contained in:
parent
f70f1f318d
commit
199bbe2fd4
24
server.go
24
server.go
@ -1787,10 +1787,30 @@ func (s *server) addPeer(p *peer) {
|
|||||||
s.wg.Add(1)
|
s.wg.Add(1)
|
||||||
go s.peerTerminationWatcher(p)
|
go s.peerTerminationWatcher(p)
|
||||||
|
|
||||||
|
switch {
|
||||||
|
// If the remote peer knows of the new gossip queries feature, then
|
||||||
|
// we'll create a new gossipSyncer in the AuthenticatedGossiper for it.
|
||||||
|
case p.remoteLocalFeatures.HasFeature(lnwire.GossipQueriesOptional):
|
||||||
|
srvrLog.Infof("Negotiated chan series queries with %x",
|
||||||
|
p.pubKeyBytes[:])
|
||||||
|
|
||||||
|
// We'll only request channel updates from the remote peer if
|
||||||
|
// its enabled in the config, or we're already getting updates
|
||||||
|
// from enough peers.
|
||||||
|
//
|
||||||
|
// TODO(roasbeef): craft s.t. we only get updates from a few
|
||||||
|
// peers
|
||||||
|
recvUpdates := !cfg.NoChanUpdates
|
||||||
|
go s.authGossiper.InitSyncState(p.addr.IdentityKey, recvUpdates)
|
||||||
|
|
||||||
// If the remote peer has the initial sync feature bit set, then we'll
|
// If the remote peer has the initial sync feature bit set, then we'll
|
||||||
// being the synchronization protocol to exchange authenticated channel
|
// being the synchronization protocol to exchange authenticated channel
|
||||||
// graph edges/vertexes
|
// graph edges/vertexes, but only if they don't know of the new gossip
|
||||||
if p.remoteLocalFeatures.HasFeature(lnwire.InitialRoutingSync) {
|
// queries.
|
||||||
|
case p.remoteLocalFeatures.HasFeature(lnwire.InitialRoutingSync):
|
||||||
|
srvrLog.Infof("Requesting full table sync with %x",
|
||||||
|
p.pubKeyBytes[:])
|
||||||
|
|
||||||
go s.authGossiper.SynchronizeNode(p.addr.IdentityKey)
|
go s.authGossiper.SynchronizeNode(p.addr.IdentityKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user