From a79404547fa78bf7105bb24cdb1bbb0e1ac7c91b Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 26 Jul 2018 13:11:38 -0400 Subject: [PATCH] re-add events --- lib/contracts/blockchain.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/contracts/blockchain.js b/lib/contracts/blockchain.js index ba34e4b3..6a18d630 100644 --- a/lib/contracts/blockchain.js +++ b/lib/contracts/blockchain.js @@ -33,7 +33,6 @@ class Blockchain { this.registerRequests(); this.registerWeb3Object(); this.registerEvents(); - } //initWeb3() { @@ -81,19 +80,19 @@ class Blockchain { } registerEvents() { - //const self = this; - //self.events.on('check:wentOffline:Ethereum', () => { - // self.logger.trace('Ethereum went offline: stopping web3 provider...'); - // self.provider.stop(); + const self = this; + self.events.on('check:wentOffline:Ethereum', () => { + self.logger.trace('Ethereum went offline: stopping web3 provider...'); + self.provider.stop(); - // // once the node goes back online, we can restart the provider - // self.events.once('check:backOnline:Ethereum', () => { - // self.logger.trace('Ethereum back online: starting web3 provider...'); - // self.provider.startWeb3Provider(() => { - // self.logger.trace('web3 provider restarted after ethereum node came back online'); - // }); - // }); - //}); + // once the node goes back online, we can restart the provider + self.events.once('check:backOnline:Ethereum', () => { + self.logger.trace('Ethereum back online: starting web3 provider...'); + self.provider.startWeb3Provider(() => { + self.logger.trace('web3 provider restarted after ethereum node came back online'); + }); + }); + }); } onReady(callback) {