From 871c2fb228852c62489c6a34bfb4197c5efc606b Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 23 May 2018 09:54:13 -0400 Subject: [PATCH] fix tests --- lib/contracts/blockchain.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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);