Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
boufni95 committed Apr 24, 2024
1 parent b5e299b commit 6e1bac6
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/services/lnd/lnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,22 @@ export default class {
this.SubscribeInvoicePaid()
this.SubscribeNewBlock()
this.SubscribeHtlcEvents()
this.ready = true
const now = Date.now()
return new Promise<void>((res, rej) => {
const interval = setInterval(async () => {
try {
await this.Health()
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"))
}
}
}, 1000)
})
}

async GetInfo(): Promise<NodeInfo> {
Expand Down

0 comments on commit 6e1bac6

Please sign in to comment.