From be727ab0be28288bb805abc0c41de905ae2c787e Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Wed, 10 Apr 2019 19:31:05 -0700 Subject: [PATCH] config+server: expose HistoricalSyncInterval flag This allows us to set how often the daemon should routinely perform historical graph syncs. --- config.go | 5 ++++- server.go | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index c8441e44..eedcf8ff 100644 --- a/config.go +++ b/config.go @@ -24,6 +24,7 @@ import ( "github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/chanbackup" "github.com/lightningnetwork/lnd/channeldb" + "github.com/lightningnetwork/lnd/discovery" "github.com/lightningnetwork/lnd/htlcswitch/hodl" "github.com/lightningnetwork/lnd/lncfg" "github.com/lightningnetwork/lnd/lnrpc/signrpc" @@ -252,7 +253,8 @@ 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"` - 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."` + 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."` + HistoricalSyncInterval time.Duration `long:"historicalsyncinterval" description:"The polling interval between historical graph sync attempts. Each historical graph sync attempt ensures we reconcile with the remote peer's graph from the genesis block."` 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."` @@ -342,6 +344,7 @@ func loadConfig() (*config, error) { Color: defaultColor, MinChanSize: int64(minChanFundingSize), NumGraphSyncPeers: defaultMinPeers, + HistoricalSyncInterval: discovery.DefaultHistoricalSyncInterval, Tor: &torConfig{ SOCKS: defaultTorSOCKS, DNS: defaultTorDNS, diff --git a/server.go b/server.go index 85bc531b..9492482d 100644 --- a/server.go +++ b/server.go @@ -689,6 +689,7 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl, RotateTicker: ticker.New(discovery.DefaultSyncerRotationInterval), HistoricalSyncTicker: ticker.New(discovery.DefaultHistoricalSyncInterval), ActiveSyncerTimeoutTicker: ticker.New(discovery.DefaultActiveSyncerTimeout), + HistoricalSyncTicker: ticker.New(cfg.HistoricalSyncInterval), NumActiveSyncers: cfg.NumGraphSyncPeers, }, s.identityPriv.PubKey(),