Skip to content

Commit 623a3ee

Browse files
authored
Merge pull request #899 from lightninglabs/lndclient-timeout
config+terminal: allow configuring of lnd RPC timeout
2 parents 2150446 + 12b3730 commit 623a3ee

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

config.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ type Config struct {
189189
// friendly. Because then we can reference the explicit modes in the
190190
// help descriptions of the section headers. We'll parse the mode into
191191
// a bool for internal use for better code readability.
192-
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"`
193-
Lnd *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"`
192+
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"`
193+
Lnd *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"`
194+
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."`
194195

195196
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"`
196197
Faraday *faraday.Config `group:"Integrated faraday options (use when faraday-mode=integrated)" namespace:"faraday"`
@@ -311,6 +312,7 @@ func defaultConfig() *Config {
311312
Network: DefaultNetwork,
312313
LndMode: DefaultLndMode,
313314
Lnd: &lndDefaultConfig,
315+
LndRPCTimeout: defaultRPCTimeout,
314316
LitDir: DefaultLitDir,
315317
LetsEncryptListen: defaultLetsEncryptListen,
316318
LetsEncryptDir: defaultLetsEncryptDir,
@@ -411,6 +413,13 @@ func loadAndValidateConfig(interceptor signal.Interceptor) (*Config, error) {
411413
cfg.Lnd.RPCMiddleware.Enable = true
412414
}
413415

416+
// We want to make sure the users don't shoot themselves in the foot by
417+
// using a too low value for the lnd RPC timeout.
418+
if cfg.LndRPCTimeout < minimumRPCTimeout {
419+
return nil, fmt.Errorf("lnd RPC timeout must be at least %v "+
420+
"to avoid problems", minimumRPCTimeout)
421+
}
422+
414423
// Validate the lightning-terminal config options.
415424
litDir := lnd.CleanAndExpandPath(preCfg.LitDir)
416425
cfg.LetsEncryptDir = lncfg.CleanAndExpandPath(cfg.LetsEncryptDir)

docs/release-notes/release-notes-0.13.7.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,19 @@
1616

1717
### Bug Fixes
1818

19+
### Functional Changes/Additions
20+
1921
* [Disable the `GRPC` internal low-level connection logger by
2022
default](https://github.com/lightninglabs/lightning-terminal/pull/896).
2123
It can still be enabled by adding `,GRPC=info` at the end of the
2224
`lnd.debuglevel` or `remote.lit-debuglevel` configuration options.
2325

24-
### Functional Changes/Additions
26+
* [Add a new `lndrpctimeout` configuration
27+
option](https://github.com/lightninglabs/lightning-terminal/pull/899) that
28+
configures the default timeout that is used when waiting for a response on any
29+
call to `lnd`. This value is used by **all** subservers for all calls, so a
30+
sufficiently long duration (>= 30 seconds) should be used. The default value
31+
was bumped from 30 seconds to 3 minutes.
2532

2633
### Technical and Architectural Updates
2734

terminal.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ const (
7474

7575
defaultServerTimeout = 10 * time.Second
7676
defaultConnectTimeout = 15 * time.Second
77+
defaultRPCTimeout = 3 * time.Minute
78+
minimumRPCTimeout = 30 * time.Second
7779
defaultStartupTimeout = 5 * time.Second
7880
)
7981

@@ -873,6 +875,7 @@ func (g *LightningTerminal) setUpLNDClients(lndQuit chan struct{}) error {
873875
BlockUntilUnlocked: true,
874876
CallerCtx: ctxc,
875877
CheckVersion: minimalCompatibleVersion,
878+
RPCTimeout: g.cfg.LndRPCTimeout,
876879
},
877880
)
878881
if err == nil {

0 commit comments

Comments
 (0)