re-add events

This commit is contained in:
Iuri Matias 2018-07-26 13:11:38 -04:00 committed by Pascal Precht
parent 91cc554978
commit 94422cd893
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 12 additions and 13 deletions

View File

@ -32,7 +32,6 @@ class Blockchain {
this.registerRequests();
this.registerWeb3Object();
this.registerEvents();
}
initWeb3() {
@ -71,19 +70,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) {