Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show LND info while it is out of sync #1294

Merged
merged 1 commit into from
Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()) {
michael1011 marked this conversation as resolved.
Show resolved Hide resolved
} 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 @@ -208,6 +208,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