mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 14:24:24 +00:00
throw error when block cannot be found
This commit is contained in:
parent
7620f16c54
commit
3c17582bd5
@ -28,6 +28,10 @@ ChainManager.prototype.loadConfig = function(config) {
|
|||||||
ChainManager.prototype.init = function(env, config) {
|
ChainManager.prototype.init = function(env, config) {
|
||||||
web3.setProvider(new web3.providers.HttpProvider("http://" + config.rpcHost + ":" + config.rpcPort));
|
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;
|
var chainId = web3.eth.getBlock(0).hash;
|
||||||
|
|
||||||
if (this.chainManagerConfig[chainId] === undefined) {
|
if (this.chainManagerConfig[chainId] === undefined) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user