Skip to content

config+terminal: allow configuring of lnd RPC timeout #899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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. 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"`
Expand Down Expand Up @@ -311,6 +312,7 @@ func defaultConfig() *Config {
Network: DefaultNetwork,
LndMode: DefaultLndMode,
Lnd: &lndDefaultConfig,
LndRPCTimeout: defaultRPCTimeout,
LitDir: DefaultLitDir,
LetsEncryptListen: defaultLetsEncryptListen,
LetsEncryptDir: defaultLetsEncryptDir,
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion docs/release-notes/release-notes-0.13.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@

### 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
* [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

Expand Down
3 changes: 3 additions & 0 deletions terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down Expand Up @@ -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 {
Expand Down
Loading