diff --git a/lib/lndclient/LndClient.ts b/lib/lndclient/LndClient.ts index 54c561fcf..1e15a8a3a 100644 --- a/lib/lndclient/LndClient.ts +++ b/lib/lndclient/LndClient.ts @@ -221,7 +221,7 @@ class LndClient extends SwapClient { let status = 'Ready'; if (this.isDisabled()) { status = errors.DISABLED(this.currency).message; - } else if (!this.isConnected()) { + } else if (this.isDisconnected()) { status = errors.UNAVAILABLE(this.currency, this.status).message; } else { try { @@ -238,7 +238,10 @@ class LndClient extends SwapClient { uris = getInfoResponse.getUrisList(); version = getInfoResponse.getVersion(); alias = getInfoResponse.getAlias(); - if (channels.active <= 0) { + + if (this.isOutOfSync()) { + status = errors.UNAVAILABLE(this.currency, this.status).message; + } else if (channels.active <= 0) { status = errors.NO_ACTIVE_CHANNELS(this.currency).message; } } catch (err) { diff --git a/lib/swaps/SwapClient.ts b/lib/swaps/SwapClient.ts index 994032c74..b4884c678 100644 --- a/lib/swaps/SwapClient.ts +++ b/lib/swaps/SwapClient.ts @@ -225,6 +225,10 @@ abstract class SwapClient extends EventEmitter { public isNotInitialized(): boolean { return this.status === ClientStatus.NotInitialized; } + public isOutOfSync(): boolean { + return this.status === ClientStatus.OutOfSync; + } + /** Ends all connections, subscriptions, and timers for for this client. */ public async close() { await this.disconnect();