Skip to content

Commit

Permalink
fix: show LND info while it is out of sync (#1294)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 authored Oct 17, 2019
1 parent 086457e commit 8fc6096
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/lndclient/LndClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions lib/swaps/SwapClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 8fc6096

Please sign in to comment.