Skip to content

Commit

Permalink
fix(whisper): fix crash on using whisper with the simualtor
Browse files Browse the repository at this point in the history
  • Loading branch information
jrainville authored and iurimatias committed Dec 12, 2018
1 parent 89c9b1f commit 1461e95
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/lib/modules/whisper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,21 @@ class Whisper {
this.connectToProvider();

this.events.request('processes:register', 'whisper', (cb) => {
this.setServiceCheck();
this.addWhisperToEmbarkJS();
this.addSetProvider();
this.waitForWeb3Ready(() => {
this.registerAPICalls();
cb();
this.web3.shh.getInfo((err) => {
if (err) {
const message = err.message || err;
if (message.indexOf('not supported') > -1) {
this.logger.error('Whisper is not supported on your node. Are you using the simulator?');
return this.logger.trace(message);
}
}
this.setServiceCheck();
this.addWhisperToEmbarkJS();
this.addSetProvider();
this.waitForWeb3Ready(() => {
this.registerAPICalls();
cb();
});
});
});

Expand Down

0 comments on commit 1461e95

Please sign in to comment.