Skip to content

Commit 651078f

Browse files
committed
config+terminal: allow configuring of lnd RPC timeout
1 parent 2150446 commit 651078f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

config.go

Lines changed: 4 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."`
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,

terminal.go

Lines changed: 10 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 = 1 * time.Minute
78+
minimumRPCTimeout = 30 * time.Second
7779
defaultStartupTimeout = 5 * time.Second
7880
)
7981

@@ -758,6 +760,13 @@ func (g *LightningTerminal) setUpLNDClients(lndQuit chan struct{}) error {
758760
clientOptions, lndclient.MacFilename(filepath.Base(macPath)),
759761
)
760762

763+
// We want to make sure the users don't shoot themselves in the foot by
764+
// using a too low value for the lnd RPC timeout.
765+
if g.cfg.LndRPCTimeout < minimumRPCTimeout {
766+
return fmt.Errorf("lnd RPC timeout must be at least %v",
767+
minimumRPCTimeout)
768+
}
769+
761770
// If we're in integrated mode, we can retrieve the macaroon string
762771
// from lnd directly, rather than grabbing it from disk.
763772
if g.cfg.LndMode == ModeIntegrated {
@@ -873,6 +882,7 @@ func (g *LightningTerminal) setUpLNDClients(lndQuit chan struct{}) error {
873882
BlockUntilUnlocked: true,
874883
CallerCtx: ctxc,
875884
CheckVersion: minimalCompatibleVersion,
885+
RPCTimeout: g.cfg.LndRPCTimeout,
876886
},
877887
)
878888
if err == nil {

0 commit comments

Comments
 (0)