Merge pull request #1801 from cfromknecht/remove-initial-graph-sync-request

server: Stop requesting initial graph sync
This commit is contained in:
Olaoluwa Osuntokun 2018-09-05 19:16:56 -07:00 committed by GitHub
commit 4100dfcf6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1959,17 +1959,6 @@ func (s *server) nextPeerBackoff(pubStr string,
return defaultBackoff
}
// shouldRequestGraphSync returns true if the servers deems it necessary that
// we sync channel graph state with the remote peer. This method is used to
// avoid _always_ syncing channel graph state with each peer that connects.
//
// NOTE: This MUST be called with the server's mutex held.
func (s *server) shouldRequestGraphSync() bool {
// Initially, we'll only request a graph sync iff we have less than two
// peers.
return len(s.peersByPub) <= 2
}
// shouldDropConnection determines if our local connection to a remote peer
// should be dropped in the case of concurrent connection establishment. In
// order to deterministically decide which connection should be dropped, we'll
@ -2257,14 +2246,6 @@ func (s *server) peerConnected(conn net.Conn, connReq *connmgr.ConnReq,
localFeatures.Set(lnwire.DataLossProtectOptional)
localFeatures.Set(lnwire.GossipQueriesOptional)
// We'll only request a full channel graph sync if we detect that that
// we aren't fully synced yet.
if s.shouldRequestGraphSync() {
// TODO(roasbeef): only do so if gossiper doesn't have active
// peers?
localFeatures.Set(lnwire.InitialRoutingSync)
}
// Now that we've established a connection, create a peer, and it to
// the set of currently active peers.
p, err := newPeer(conn, connReq, s, peerAddr, inbound, localFeatures)