Merge pull request #2251 from mempool/nymkappa/bugfix/clightning-crash

Don't throw an exception when cln connection is down
This commit is contained in:
wiz
2022-08-08 17:28:50 +09:00
committed by GitHub
2 changed files with 16 additions and 5 deletions

View File

@@ -157,8 +157,18 @@ export default class CLightningClient extends EventEmitter implements AbstractLi
const _self = this;
this.client = createConnection(rpcPath);
this.rl = createInterface({ input: this.client })
this.client = createConnection(rpcPath).on(
'error', () => {
_self.increaseWaitTime();
_self.reconnect();
}
);
this.rl = createInterface({ input: this.client }).on(
'error', () => {
_self.increaseWaitTime();
_self.reconnect();
}
);
this.clientConnectionPromise = new Promise<void>(resolve => {
_self.client.on('connect', () => {
@@ -175,7 +185,6 @@ export default class CLightningClient extends EventEmitter implements AbstractLi
_self.client.on('error', error => {
logger.err(`[CLightningClient] Lightning client connection error: ${error}`);
_self.emit('error', error);
_self.increaseWaitTime();
_self.reconnect();
});