Skip to content

Commit fd5a138

Browse files
committed
tapcfg: allow to configure lnd RPC timeout, increase default val
This fixes an issue where tapd would shut down because querying channels on a slow lnd would time out: ``` 2024-10-30 10:06:21.535 [DBG] STAT: Setting the taproot-assets sub-server as errored: received critical error from sub-server (taproot-assets), shutting down: failed to handle outgoing message: error adding local alias: add alias: error listing local channels: rpc error: code = DeadlineExceeded desc = context deadline exceeded ```
1 parent 55c55c9 commit fd5a138

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

sample-tapd.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@
213213
; Path to lnd tls certificate
214214
; lnd.tlspath=
215215

216+
; The timeout to use for RPC requests to lnd; a sufficiently long duration
217+
; should be chosen to avoid issues with slow responses
218+
; lnd.rpctimeout=1m
219+
216220
[sqlite]
217221

218222
; Skip applying migrations on startup

tapcfg/config.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ const (
130130
// waits having identified an asset transfer on-chain and before
131131
// retrieving the corresponding proof via the proof courier service.
132132
defaultProofRetrievalDelay = 5 * time.Second
133+
134+
// defaultLndRPCTimeout is the default timeout we'll use for RPC
135+
// requests to lnd.
136+
defaultLndRPCTimeout = 1 * time.Minute
133137
)
134138

135139
var (
@@ -258,6 +262,9 @@ type LndConfig struct {
258262
MacaroonPath string `long:"macaroonpath" description:"The full path to the single macaroon to use, either the admin.macaroon or a custom baked one. Cannot be specified at the same time as macaroondir. A custom macaroon must contain ALL permissions required for all subservers to work, otherwise permission errors will occur."`
259263

260264
TLSPath string `long:"tlspath" description:"Path to lnd tls certificate"`
265+
266+
// RPCTimeout is the timeout we'll use for RPC requests to lnd.
267+
RPCTimeout time.Duration `long:"rpctimeout" description:"The timeout to use for RPC requests to lnd; a sufficiently long duration should be chosen to avoid issues with slow responses"`
261268
}
262269

263270
// UniverseConfig is the config that houses any Universe related config
@@ -385,6 +392,7 @@ func DefaultConfig() Config {
385392
Lnd: &LndConfig{
386393
Host: "localhost:10009",
387394
MacaroonPath: defaultLndMacaroonPath,
395+
RPCTimeout: defaultLndRPCTimeout,
388396
},
389397
DatabaseBackend: DatabaseBackendSqlite,
390398
Sqlite: &tapdb.SqliteConfig{
@@ -1150,5 +1158,6 @@ func getLnd(network string, cfg *LndConfig,
11501158
BlockUntilChainSynced: true,
11511159
BlockUntilUnlocked: true,
11521160
CallerCtx: ctxc,
1161+
RPCTimeout: cfg.RPCTimeout,
11531162
})
11541163
}

0 commit comments

Comments
 (0)