@@ -79,7 +79,7 @@ class LndClient extends BaseClient {
79
79
shouldDisable = true ;
80
80
}
81
81
if ( shouldDisable ) {
82
- this . setStatus ( ClientStatus . Disabled ) ;
82
+ await this . setStatus ( ClientStatus . Disabled ) ;
83
83
return ;
84
84
}
85
85
@@ -96,8 +96,8 @@ class LndClient extends BaseClient {
96
96
this . logger . info ( `macaroons are disabled for lnd for ${ this . currency } ` ) ;
97
97
}
98
98
// set status as disconnected until we can verify the connection
99
- this . setStatus ( ClientStatus . Disconnected ) ;
100
- return this . verifyConnection ( ) ;
99
+ await this . setStatus ( ClientStatus . Disconnected ) ;
100
+ await this . verifyConnection ( ) ;
101
101
}
102
102
103
103
public get pubKey ( ) {
@@ -178,7 +178,7 @@ class LndClient extends BaseClient {
178
178
const getInfoResponse = await this . getInfo ( ) ;
179
179
if ( getInfoResponse . getSyncedToChain ( ) ) {
180
180
// mark connection as active
181
- this . setStatus ( ClientStatus . ConnectionVerified ) ;
181
+ await this . setStatus ( ClientStatus . ConnectionVerified ) ;
182
182
if ( this . reconnectionTimer ) {
183
183
clearTimeout ( this . reconnectionTimer ) ;
184
184
this . reconnectionTimer = undefined ;
@@ -193,12 +193,12 @@ class LndClient extends BaseClient {
193
193
this . emit ( 'connectionVerified' , newPubKey ) ;
194
194
this . subscribeInvoices ( ) ;
195
195
} else {
196
- this . setStatus ( ClientStatus . OutOfSync ) ;
196
+ await this . setStatus ( ClientStatus . OutOfSync ) ;
197
197
this . logger . error ( `lnd for ${ this . currency } is out of sync with chain, retrying in ${ LndClient . RECONNECT_TIMER } ms` ) ;
198
198
this . reconnectionTimer = setTimeout ( this . verifyConnection , LndClient . RECHECK_SYNC_TIMER ) ;
199
199
}
200
200
} catch ( err ) {
201
- this . setStatus ( ClientStatus . Disconnected ) ;
201
+ await this . setStatus ( ClientStatus . Disconnected ) ;
202
202
this . logger . error ( `could not verify connection to lnd for ${ this . currency } at ${ this . uri } , error: ${ JSON . stringify ( err ) } ,
203
203
retrying in ${ LndClient . RECONNECT_TIMER } ms` ) ;
204
204
this . reconnectionTimer = setTimeout ( this . verifyConnection , LndClient . RECONNECT_TIMER ) ;
@@ -382,9 +382,9 @@ class LndClient extends BaseClient {
382
382
}
383
383
384
384
this . invoiceSubscription = this . lightning . subscribeInvoices ( new lndrpc . InvoiceSubscription ( ) , this . meta )
385
- . on ( 'error' , ( error ) => {
385
+ . on ( 'error' , async ( error ) => {
386
386
this . invoiceSubscription = undefined ;
387
- this . setStatus ( ClientStatus . Disconnected ) ;
387
+ await this . setStatus ( ClientStatus . Disconnected ) ;
388
388
this . logger . error ( `lnd for ${ this . currency } has been disconnected, error: ${ error } ` ) ;
389
389
this . reconnectionTimer = setTimeout ( this . verifyConnection , LndClient . RECONNECT_TIMER ) ;
390
390
} ) ;
0 commit comments