move getBlock to blockchain module

This commit is contained in:
Iuri Matias 2018-05-18 18:50:20 -04:00 committed by Jonathan Rainville
parent 1547a115a4
commit 84dcfca254
3 changed files with 7 additions and 3 deletions

View File

@ -86,6 +86,10 @@ class Blockchain {
this.web3.eth.getCode(address, cb);
}
getBlock(blockNumber, cb) {
this.web3.eth.getBlock(blockNumber, cb);
}
}
module.exports = Blockchain;

View File

@ -26,7 +26,7 @@ class Deploy {
initTracker(cb) {
this.deployTracker = new DeployTracker({
logger: this.logger, chainConfig: this.chainConfig, web3: this.web3, env: this.env
logger: this.logger, chainConfig: this.chainConfig, blockchain: this.blockchain, env: this.env
}, cb);
}

View File

@ -7,14 +7,14 @@ class DeployTracker {
this.logger = options.logger;
this.env = options.env;
this.chainConfig = options.chainConfig;
this.web3 = options.web3;
this.blockchain = options.blockchain;
if (this.chainConfig === false) {
this.currentChain = {contracts: []};
return cb();
}
this.web3.eth.getBlock(0, function(err, block) {
this.blockchain.getBlock(0, function(err, block) {
let chainId = block.hash;
if (self.chainConfig[chainId] === undefined) {