From 645c8985e0280d998e410aaff4c2dc0fd4888b86 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 1 Jul 2021 10:24:36 +0200 Subject: [PATCH 1/2] config: bump default LSAT max fee to 5% It seems like 1% max routing fee is too small a number for a small payment amount of 1k as a non-default base fee can already be as high for some channels. We bump the default max LSAT routing fee to 5% to have a better chance of finding decent routes. --- config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.go b/config.go index d736ff3..aa463b0 100644 --- a/config.go +++ b/config.go @@ -163,7 +163,7 @@ const ( // is allowed to take to complete. defaultRPCTimeout = 30 * time.Second defaultLsatMaxCost = btcutil.Amount(1000) - defaultLsatMaxFee = btcutil.Amount(10) + defaultLsatMaxFee = btcutil.Amount(50) ) // DefaultConfig returns the default value for the Config struct. From ab46aa7a4954a76cd476bd63218edc90c7a10af6 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 1 Jul 2021 10:31:08 +0200 Subject: [PATCH 2/2] server+config: allow max LSAT routing fee to be configured If users are only connected to the network through nodes with high fees even the 5% default routing fee for the LSAT might not be enough. To avoid them needing to compile Pool with a custom value, we expose that value as a config option. --- config.go | 31 +++++++++++++++++-------------- server.go | 2 +- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/config.go b/config.go index aa463b0..ca1dc87 100644 --- a/config.go +++ b/config.go @@ -137,6 +137,8 @@ type Config struct { NewNodesOnly bool `long:"newnodesonly" description:"Only accept channels from nodes that the connected lnd node doesn't already have open or pending channels with."` + LsatMaxRoutingFee btcutil.Amount `long:"lsatmaxroutingfee" description:"The maximum amount in satoshis we are willing to pay in routing fees when paying for the one-time LSAT auth token that is required to use the Pool service."` + Profile string `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65535"` FakeAuth bool `long:"fakeauth" description:"Disable LSAT authentication and instead use a fake LSAT ID to identify. For testing only, cannot be set on mainnet."` @@ -169,20 +171,21 @@ const ( // DefaultConfig returns the default value for the Config struct. func DefaultConfig() Config { return Config{ - Network: DefaultNetwork, - RPCListen: "localhost:12010", - RESTListen: "localhost:8281", - Insecure: false, - BaseDir: DefaultBaseDir, - LogDir: defaultLogDir, - MaxLogFiles: defaultMaxLogFiles, - MaxLogFileSize: defaultMaxLogFileSize, - MinBackoff: defaultMinBackoff, - MaxBackoff: defaultMaxBackoff, - DebugLevel: defaultLogLevel, - TLSCertPath: DefaultTLSCertPath, - TLSKeyPath: DefaultTLSKeyPath, - MacaroonPath: DefaultMacaroonPath, + Network: DefaultNetwork, + RPCListen: "localhost:12010", + RESTListen: "localhost:8281", + Insecure: false, + BaseDir: DefaultBaseDir, + LogDir: defaultLogDir, + MaxLogFiles: defaultMaxLogFiles, + MaxLogFileSize: defaultMaxLogFileSize, + MinBackoff: defaultMinBackoff, + MaxBackoff: defaultMaxBackoff, + DebugLevel: defaultLogLevel, + TLSCertPath: DefaultTLSCertPath, + TLSKeyPath: DefaultTLSKeyPath, + MacaroonPath: DefaultMacaroonPath, + LsatMaxRoutingFee: defaultLsatMaxFee, Lnd: &LndConfig{ Host: "localhost:10009", MacaroonPath: DefaultLndMacaroonPath, diff --git a/server.go b/server.go index 231ccbc..41e13e6 100644 --- a/server.go +++ b/server.go @@ -441,7 +441,7 @@ func (s *Server) setupClient() error { // trader instead. var interceptor Interceptor = lsat.NewInterceptor( &s.lndServices.LndServices, s.lsatStore, defaultRPCTimeout, - defaultLsatMaxCost, defaultLsatMaxFee, false, + defaultLsatMaxCost, s.cfg.LsatMaxRoutingFee, false, ) if s.cfg.FakeAuth && s.cfg.Network == "mainnet" { return fmt.Errorf("cannot use fake LSAT auth for mainnet")