fix(lnd): wait for chain/graph sync before marking LND ready
Some checks failed
Docker Compose Actions Workflow / test (push) Has been cancelled
Some checks failed
Docker Compose Actions Workflow / test (push) Has been cancelled
Warmup() previously only checked that LND responded to GetInfo(), but did not verify syncedToChain/syncedToGraph. This caused LP to accept requests while LND was still syncing, leading to "not synced" errors on every Health() check. Now waits for full sync with a 10min timeout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7973fa83cb
commit
b1fd18d45c
1 changed files with 9 additions and 4 deletions
|
|
@ -142,15 +142,20 @@ export default class {
|
|||
return new Promise<void>((res, rej) => {
|
||||
const interval = setInterval(async () => {
|
||||
try {
|
||||
await this.GetInfo()
|
||||
const info = await this.GetInfo()
|
||||
if (!info.syncedToChain || !info.syncedToGraph) {
|
||||
this.log("LND responding but not synced yet, waiting...")
|
||||
return
|
||||
}
|
||||
clearInterval(interval)
|
||||
this.ready = true
|
||||
res()
|
||||
} catch (err) {
|
||||
this.log("LND is not ready yet, will try again in 1 second")
|
||||
if (Date.now() - now > 1000 * 60) {
|
||||
rej(new Error("LND not ready after 1 minute"))
|
||||
}
|
||||
if (Date.now() - now > 1000 * 60 * 10) {
|
||||
clearInterval(interval)
|
||||
rej(new Error("LND not synced after 10 minutes"))
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue