throw error when block cannot be found

This commit is contained in:
Frederic Heem 2015-09-25 08:44:37 +01:00
parent 7620f16c54
commit 3c17582bd5
1 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,10 @@ ChainManager.prototype.loadConfig = function(config) {
ChainManager.prototype.init = function(env, config) {
web3.setProvider(new web3.providers.HttpProvider("http://" + config.rpcHost + ":" + config.rpcPort));
var block = web3.eth.getBlock(0);
if(!block){
throw new Error("Cannot get the genesis block, is embark blockchain running ?");
}
var chainId = web3.eth.getBlock(0).hash;
if (this.chainManagerConfig[chainId] === undefined) {