diff --git a/lib/contracts/blockchain.js b/lib/contracts/blockchain.js index de84e9af2..374bbf49d 100644 --- a/lib/contracts/blockchain.js +++ b/lib/contracts/blockchain.js @@ -17,12 +17,14 @@ class Blockchain { this.blockchainConfig = options.blockchainConfig; this.web3 = options.web3; this.addCheck = options.addCheck; - this.web3Endpoint = 'http://' + this.contractsConfig.deployment.host + ':' + this.contractsConfig.deployment.port; + this.web3Endpoint = ''; this.isWeb3Ready = false; this.web3StartedInProcess = false; if (!this.web3) { this.initWeb3(); + } else { + this.isWeb3Ready = true; } this.registerServiceCheck(); this.registerRequests(); @@ -40,6 +42,7 @@ class Blockchain { this.web3 = new Web3(); if (this.contractsConfig.deployment.type === "rpc") { let provider; + this.web3Endpoint = 'http://' + this.contractsConfig.deployment.host + ':' + this.contractsConfig.deployment.port; const providerOptions = { web3: this.web3, @@ -224,6 +227,9 @@ class Blockchain { next(); }, function pingEndpoint(next) { + if (!self.web3Endpoint) { + return next(); + } request.get(self.web3Endpoint, function (err, _response, _body) { if (err) { return next(NO_NODE_ERROR);