fix(@embark/deploy-tracker): fix getting the block 0 with sim --fork

This commit is contained in:
Jonathan Rainville 2019-06-27 13:28:18 -04:00 committed by Michael Bradley
parent 1b6987ee8f
commit f6d7a54195

View File

@ -58,13 +58,15 @@ class DeployTracker {
});
}
setCurrentChain(cb) {
setCurrentChain(callback) {
const self = this;
if (this.chainConfig === false) {
this.currentChain = {contracts: []};
return cb();
return callback();
}
this.events.request("blockchain:block:byNumber", 0, function(err, block) {
function getBlock(blockNum, cb) {
self.events.request("blockchain:block:byNumber", blockNum, (err, block) => {
if (err) {
return cb(err);
}
@ -81,6 +83,15 @@ class DeployTracker {
});
}
getBlock(0, (err) => {
if (err) {
// Retry with block 1 (Block 0 fails with Ganache-cli using the --fork option)
return getBlock(1, callback);
}
callback();
});
}
loadConfig(config) {
this.chainConfig = config;
return this;