fix(electrumx): Fixed connect/disconnect bug that was preventing tests

This commit is contained in:
Chris Troutner
2020-11-21 11:29:18 -08:00
parent 7dee8c0604
commit 319281c096
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -81,7 +81,7 @@ class Electrum {
// Periodically check the connection. If it's not connected, attempt to
// reconnect.
setInterval(async function () {
_this.reconnectIntervalHandle = setInterval(async function () {
const status = _this.electrumx.connection.status
// console.log(`Electrumx status: ${status}`)
@@ -111,6 +111,9 @@ class Electrum {
// Return immediately if the isReady flag is false.
if (!_this.isReady) return true
// Disable the reconnect timer.
clearInterval(_this.reconnectIntervalHandle)
// Disconnect from the server.
await _this.electrumx.disconnect()
+1 -1
View File
@@ -42,7 +42,7 @@ function expectRouteError (res, result, expectedError, code = 400) {
assert.equal(result.success, false)
}
describe('#ElectrumX Router', () => {
describe('#Electrumx', () => {
let req, res
let sandbox
const electrumxRoute = new ElecrumxRoute()