From 8790d3b3e2e3572da192f1775307aad88c6eecdb Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 7 Nov 2024 17:56:46 +0100 Subject: [PATCH 1/3] config+terminal: allow configuring of lnd RPC timeout --- config.go | 13 +++++++++++-- terminal.go | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/config.go b/config.go index 1c478b75e..b547e6c4d 100644 --- a/config.go +++ b/config.go @@ -189,8 +189,9 @@ type Config struct { // friendly. Because then we can reference the explicit modes in the // help descriptions of the section headers. We'll parse the mode into // a bool for internal use for better code readability. - LndMode string `long:"lnd-mode" description:"The mode to run lnd in, either 'remote' (default) or 'integrated'. 'integrated' means lnd is started alongside the UI and everything is stored in lnd's main data directory, configure everything by using the --lnd.* flags. 'remote' means the UI connects to an existing lnd node and acts as a proxy for gRPC calls to it. In the remote node LiT creates its own directory for log and configuration files, configure everything using the --remote.* flags." choice:"integrated" choice:"remote"` - Lnd *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"` + LndMode string `long:"lnd-mode" description:"The mode to run lnd in, either 'remote' (default) or 'integrated'. 'integrated' means lnd is started alongside the UI and everything is stored in lnd's main data directory, configure everything by using the --lnd.* flags. 'remote' means the UI connects to an existing lnd node and acts as a proxy for gRPC calls to it. In the remote node LiT creates its own directory for log and configuration files, configure everything using the --remote.* flags." choice:"integrated" choice:"remote"` + Lnd *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"` + LndRPCTimeout time.Duration `long:"lndrpctimeout" description:"The timeout for RPC calls to lnd from other sub servers. This can be adjusted for slow lnd instances to give loop/pool/faraday/taproot-assets more time when querying into lnd's RPC methods."` FaradayMode string `long:"faraday-mode" description:"The mode to run faraday in, either 'integrated' (default), 'remote' or 'disable'. 'integrated' means faraday is started alongside the UI and everything is stored in faraday's main data directory, configure everything by using the --faraday.* flags. 'remote' means the UI connects to an existing faraday node and acts as a proxy for gRPC calls to it. 'disable' means that LiT is started without faraday." choice:"integrated" choice:"remote" choice:"disable"` Faraday *faraday.Config `group:"Integrated faraday options (use when faraday-mode=integrated)" namespace:"faraday"` @@ -311,6 +312,7 @@ func defaultConfig() *Config { Network: DefaultNetwork, LndMode: DefaultLndMode, Lnd: &lndDefaultConfig, + LndRPCTimeout: defaultRPCTimeout, LitDir: DefaultLitDir, LetsEncryptListen: defaultLetsEncryptListen, LetsEncryptDir: defaultLetsEncryptDir, @@ -411,6 +413,13 @@ func loadAndValidateConfig(interceptor signal.Interceptor) (*Config, error) { cfg.Lnd.RPCMiddleware.Enable = true } + // We want to make sure the users don't shoot themselves in the foot by + // using a too low value for the lnd RPC timeout. + if cfg.LndRPCTimeout < minimumRPCTimeout { + return nil, fmt.Errorf("lnd RPC timeout must be at least %v "+ + "to avoid problems", minimumRPCTimeout) + } + // Validate the lightning-terminal config options. litDir := lnd.CleanAndExpandPath(preCfg.LitDir) cfg.LetsEncryptDir = lncfg.CleanAndExpandPath(cfg.LetsEncryptDir) diff --git a/terminal.go b/terminal.go index c7b5deef4..88a7d3f1f 100644 --- a/terminal.go +++ b/terminal.go @@ -74,6 +74,8 @@ const ( defaultServerTimeout = 10 * time.Second defaultConnectTimeout = 15 * time.Second + defaultRPCTimeout = 3 * time.Minute + minimumRPCTimeout = 30 * time.Second defaultStartupTimeout = 5 * time.Second ) @@ -873,6 +875,7 @@ func (g *LightningTerminal) setUpLNDClients(lndQuit chan struct{}) error { BlockUntilUnlocked: true, CallerCtx: ctxc, CheckVersion: minimalCompatibleVersion, + RPCTimeout: g.cfg.LndRPCTimeout, }, ) if err == nil { From ab137035c6b24365c80fc093787c184897badaf8 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Fri, 8 Nov 2024 09:20:04 +0100 Subject: [PATCH 2/3] docs: move previous item to correct category --- config.go | 2 +- docs/release-notes/release-notes-0.13.7.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index b547e6c4d..bd1789986 100644 --- a/config.go +++ b/config.go @@ -191,7 +191,7 @@ type Config struct { // a bool for internal use for better code readability. LndMode string `long:"lnd-mode" description:"The mode to run lnd in, either 'remote' (default) or 'integrated'. 'integrated' means lnd is started alongside the UI and everything is stored in lnd's main data directory, configure everything by using the --lnd.* flags. 'remote' means the UI connects to an existing lnd node and acts as a proxy for gRPC calls to it. In the remote node LiT creates its own directory for log and configuration files, configure everything using the --remote.* flags." choice:"integrated" choice:"remote"` Lnd *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"` - LndRPCTimeout time.Duration `long:"lndrpctimeout" description:"The timeout for RPC calls to lnd from other sub servers. This can be adjusted for slow lnd instances to give loop/pool/faraday/taproot-assets more time when querying into lnd's RPC methods."` + LndRPCTimeout time.Duration `long:"lndrpctimeout" description:"The timeout for RPC calls to lnd from other sub servers. This can be adjusted for slow lnd instances to give loop/pool/faraday/taproot-assets more time when querying into lnd's RPC methods. This value should NOT be set to anything below 30 seconds to avoid problems."` FaradayMode string `long:"faraday-mode" description:"The mode to run faraday in, either 'integrated' (default), 'remote' or 'disable'. 'integrated' means faraday is started alongside the UI and everything is stored in faraday's main data directory, configure everything by using the --faraday.* flags. 'remote' means the UI connects to an existing faraday node and acts as a proxy for gRPC calls to it. 'disable' means that LiT is started without faraday." choice:"integrated" choice:"remote" choice:"disable"` Faraday *faraday.Config `group:"Integrated faraday options (use when faraday-mode=integrated)" namespace:"faraday"` diff --git a/docs/release-notes/release-notes-0.13.7.md b/docs/release-notes/release-notes-0.13.7.md index 4a983ada8..6629c96bd 100644 --- a/docs/release-notes/release-notes-0.13.7.md +++ b/docs/release-notes/release-notes-0.13.7.md @@ -16,13 +16,13 @@ ### Bug Fixes +### Functional Changes/Additions + * [Disable the `GRPC` internal low-level connection logger by default](https://github.com/lightninglabs/lightning-terminal/pull/896). It can still be enabled by adding `,GRPC=info` at the end of the `lnd.debuglevel` or `remote.lit-debuglevel` configuration options. -### Functional Changes/Additions - ### Technical and Architectural Updates ## Integrated Binary Updates From 12b37309be3b32fd9e091827ceeec3051b233935 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Fri, 8 Nov 2024 09:25:18 +0100 Subject: [PATCH 3/3] docs: add release notes --- docs/release-notes/release-notes-0.13.7.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/release-notes/release-notes-0.13.7.md b/docs/release-notes/release-notes-0.13.7.md index 6629c96bd..881897bbb 100644 --- a/docs/release-notes/release-notes-0.13.7.md +++ b/docs/release-notes/release-notes-0.13.7.md @@ -23,6 +23,13 @@ It can still be enabled by adding `,GRPC=info` at the end of the `lnd.debuglevel` or `remote.lit-debuglevel` configuration options. +* [Add a new `lndrpctimeout` configuration + option](https://github.com/lightninglabs/lightning-terminal/pull/899) that + configures the default timeout that is used when waiting for a response on any + call to `lnd`. This value is used by **all** subservers for all calls, so a + sufficiently long duration (>= 30 seconds) should be used. The default value + was bumped from 30 seconds to 3 minutes. + ### Technical and Architectural Updates ## Integrated Binary Updates