From 325deb36c0f4c32126efcd71493d5ba898989de2 Mon Sep 17 00:00:00 2001 From: carla Date: Wed, 21 Oct 2020 11:22:33 +0200 Subject: [PATCH 1/2] sample-conf: add assumechanvalid to sample conf --- sample-lnd.conf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sample-lnd.conf b/sample-lnd.conf index 54f036c8..91be6357 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -408,6 +408,15 @@ bitcoin.node=btcd ; Used to help identify ourselves to other bitcoin peers (default: 0.11.0-beta). ; neutrino.useragentversion=0.11.0-beta +; Skip checking channel spentness and existence during graph validation for +; neutrino. Enabling this option means that neutrino nodes will not need to +; perform long rescans which block initial usage of the daemon, but comes at +; the cost of not validating channels in your routing graph. Skipping this +; validation means that your node may have an incorrect view of the network +; if it receives updates for closed or non-existent channels. This could affect +; routing, but funds are safu. +; --routing.assumechanvalid=true + [Btcd] ; The base directory that contains the node's data, logs, configuration file, From c92b030652e5eb728baebb04725e8574982616dd Mon Sep 17 00:00:00 2001 From: carla Date: Wed, 21 Oct 2020 11:22:34 +0200 Subject: [PATCH 2/2] multi: remove experimential build flag for assumechanvalid --- Makefile | 4 ++-- config.go | 2 +- lncfg/routing.go | 6 ++++++ routing/conf.go | 12 ------------ routing/conf_experimental.go | 14 -------------- server.go | 2 +- 6 files changed, 10 insertions(+), 30 deletions(-) create mode 100644 lncfg/routing.go delete mode 100644 routing/conf.go delete mode 100644 routing/conf_experimental.go diff --git a/Makefile b/Makefile index f28bef3d..5f55f0bc 100644 --- a/Makefile +++ b/Makefile @@ -269,12 +269,12 @@ vendor: ios: vendor mobile-rpc @$(call print, "Building iOS framework ($(IOS_BUILD)).") mkdir -p $(IOS_BUILD_DIR) - $(GOMOBILE_BIN) bind -target=ios -tags="mobile $(DEV_TAGS) autopilotrpc experimental" $(LDFLAGS) -v -o $(IOS_BUILD) $(MOBILE_PKG) + $(GOMOBILE_BIN) bind -target=ios -tags="mobile $(DEV_TAGS) autopilotrpc" $(LDFLAGS) -v -o $(IOS_BUILD) $(MOBILE_PKG) android: vendor mobile-rpc @$(call print, "Building Android library ($(ANDROID_BUILD)).") mkdir -p $(ANDROID_BUILD_DIR) - $(GOMOBILE_BIN) bind -target=android -tags="mobile $(DEV_TAGS) autopilotrpc experimental" $(LDFLAGS) -v -o $(ANDROID_BUILD) $(MOBILE_PKG) + $(GOMOBILE_BIN) bind -target=android -tags="mobile $(DEV_TAGS) autopilotrpc" $(LDFLAGS) -v -o $(ANDROID_BUILD) $(MOBILE_PKG) mobile: ios android diff --git a/config.go b/config.go index e576284a..7a299bf1 100644 --- a/config.go +++ b/config.go @@ -285,7 +285,7 @@ type Config struct { GcCanceledInvoicesOnTheFly bool `long:"gc-canceled-invoices-on-the-fly" description:"If true, we'll delete newly canceled invoices on the fly."` - Routing *routing.Conf `group:"routing" namespace:"routing"` + Routing *lncfg.Routing `group:"routing" namespace:"routing"` Workers *lncfg.Workers `group:"workers" namespace:"workers"` diff --git a/lncfg/routing.go b/lncfg/routing.go new file mode 100644 index 00000000..2eabb38e --- /dev/null +++ b/lncfg/routing.go @@ -0,0 +1,6 @@ +package lncfg + +// Routing holds the configuration options for routing. +type Routing struct { + AssumeChannelValid bool `long:"assumechanvalid" description:"Skip checking channel spentness during graph validation. This speedup comes at the risk of using an unvalidated view of the network for routing. (default: false)"` +} diff --git a/routing/conf.go b/routing/conf.go deleted file mode 100644 index ccce7c38..00000000 --- a/routing/conf.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build !experimental - -package routing - -// Conf provides the command line routing configuration. There are no fields in -// the production build so that this section is hidden by default. -type Conf struct{} - -// UseAssumeChannelValid always returns false when not in experimental builds. -func (c *Conf) UseAssumeChannelValid() bool { - return false -} diff --git a/routing/conf_experimental.go b/routing/conf_experimental.go deleted file mode 100644 index 5c11c9cd..00000000 --- a/routing/conf_experimental.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build experimental - -package routing - -// Conf exposes the experimental command line routing configurations. -type Conf struct { - AssumeChannelValid bool `long:"assumechanvalid" description:"Skip checking channel spentness during graph validation. (default: false)"` -} - -// UseAssumeChannelValid returns true if the router should skip checking for -// spentness when processing channel updates and announcements. -func (c *Conf) UseAssumeChannelValid() bool { - return c.AssumeChannelValid -} diff --git a/server.go b/server.go index 177d0892..edb74ca8 100644 --- a/server.go +++ b/server.go @@ -761,7 +761,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr, ChannelPruneExpiry: routing.DefaultChannelPruneExpiry, GraphPruneInterval: time.Duration(time.Hour), QueryBandwidth: queryBandwidth, - AssumeChannelValid: cfg.Routing.UseAssumeChannelValid(), + AssumeChannelValid: cfg.Routing.AssumeChannelValid, NextPaymentID: sequencer.NextID, PathFindingConfig: pathFindingConfig, Clock: clock.NewDefaultClock(),