update whisper check

This commit is contained in:
Iuri Matias 2018-01-05 15:30:52 -05:00
parent 59c3d82260
commit 4fcfc6c142
2 changed files with 20 additions and 13 deletions

View File

@ -191,21 +191,28 @@ class Engine {
} }
self.servicesMonitor.addCheck('Ethereum', function (cb) { self.servicesMonitor.addCheck('Ethereum', function (cb) {
if (self.web3.connected) { if (self.web3.currentProvider === undefined) {
return cb({
name: (self.web3.version.node.split("/")[0] + " " + self.web3.version.node.split("/")[1].split("-")[0] + " (Ethereum)"),
status: 'on'
});
} else {
return cb({name: "No Blockchain node found", status: 'off'}); return cb({name: "No Blockchain node found", status: 'off'});
} }
self.web3.eth.getAccounts(function(err, _accounts) {
if (err) {
return cb({name: "No Blockchain node found", status: 'off'});
}
return cb({
//name: (self.web3.version.node.split("/")[0] + " " + self.web3.version.node.split("/")[1].split("-")[0] + " (Ethereum)"),
// TODO: get nodename
name: "Ethereum node",
status: 'on'
});
});
}); });
//this.registerModule('whisper', { this.registerModule('whisper', {
// addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor), addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor),
// communicationConfig: this.config.communicationConfig, communicationConfig: this.config.communicationConfig,
// web3: this.web3 web3: this.web3
//}); });
} }
libraryManagerService(_options) { libraryManagerService(_options) {

View File

@ -19,8 +19,8 @@ class Whisper {
setServiceCheck() { setServiceCheck() {
const self = this; const self = this;
self.addCheck('Whisper', function (cb) { self.addCheck('Whisper', function (cb) {
self.web3.version.getWhisper(function (err, version) { self.web3.shh.getVersion(function (err, version) {
if (err) { if (err || version == "2") {
return cb({name: 'Whisper', status: 'off'}); return cb({name: 'Whisper', status: 'off'});
} else { } else {
return cb({name: 'Whisper (version ' + version + ')', status: 'on'}); return cb({name: 'Whisper (version ' + version + ')', status: 'on'});