From 80b84eef9cc7b33b112dcde597fe68ca136a9f40 Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Fri, 22 Mar 2019 19:56:18 -0700 Subject: [PATCH] config+peer: replace NoChanUpdates flag with NumGraphSyncPeers In this commit, we replace the NoChanUpdates flag with a flag that allows us to specify the number of peers we want to actively receive new graph updates from. This will be required when integrating the new gossiper SyncManager subsystem with the rest of lnd. --- config.go | 3 ++- peer.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.go b/config.go index 8589cec57..167743ed9 100644 --- a/config.go +++ b/config.go @@ -248,7 +248,7 @@ type config struct { Color string `long:"color" description:"The color of the node in hex format (i.e. '#3399FF'). Used to customize node appearance in intelligence services"` MinChanSize int64 `long:"minchansize" description:"The smallest channel size (in satoshis) that we should accept. Incoming channels smaller than this will be rejected"` - NoChanUpdates bool `long:"nochanupdates" description:"If specified, lnd will not request real-time channel updates from connected peers. This option should be used by routing nodes to save bandwidth."` + NumGraphSyncPeers int `long:"numgraphsyncpeers" description:"The number of peers that we should receive new graph updates from. This option can be tuned to save bandwidth for light clients or routing nodes."` RejectPush bool `long:"rejectpush" description:"If true, lnd will not accept channel opening requests with non-zero push amounts. This should prevent accidental pushes to merchant nodes."` @@ -335,6 +335,7 @@ func loadConfig() (*config, error) { Alias: defaultAlias, Color: defaultColor, MinChanSize: int64(minChanFundingSize), + NumGraphSyncPeers: defaultMinPeers, Tor: &torConfig{ SOCKS: defaultTorSOCKS, DNS: defaultTorDNS, diff --git a/peer.go b/peer.go index 69b4cf082..f4f029fa0 100644 --- a/peer.go +++ b/peer.go @@ -402,7 +402,7 @@ func (p *peer) initGossipSync() { // // TODO(roasbeef): craft s.t. we only get updates from a few // peers - recvUpdates := !cfg.NoChanUpdates + recvUpdates := cfg.NumGraphSyncPeers != 0 // Register the this peer's for gossip syncer with the gossiper. // This is blocks synchronously to ensure the gossip syncer is