move - for now - determining gas price to deployment to avoid race conditions

This commit is contained in:
Iuri Matias 2018-07-17 15:10:22 +03:00
parent 296663edc7
commit d0162a6c78
2 changed files with 8 additions and 7 deletions

View File

@ -199,6 +199,13 @@ class ContractDeployer {
function applyBeforeDeploy(next) {
self.plugins.emitAndRunActionsForEvent('deploy:contract:beforeDeploy', {contract: contract}, next);
},
function getGasPriceForNetwork(next) {
self.events.request("blockchain:gasPrice", (gasPrice) => {
console.dir('[contracts/contracts]: got gasPrice of ' + gasPrice);
contract.gasPrice = contract.gasPrice || gasPrice;
next();
});
},
function createDeployObject(next) {
let contractObject = self.blockchain.ContractObject({abi: contract.abiDefinition});

View File

@ -95,13 +95,7 @@ class ContractsManager {
},
function getGasPriceForNetwork(callback) {
console.dir('[contracts/contracts]: gas price for network, passed in gasPrice from config: ' + self.contractsConfig.gasPrice);
if (self.contractsConfig.gasPrice) {
return callback(null, self.contractsConfig.gasPrice);
}
self.events.request("blockchain:gasPrice", (gasprice) => {
console.dir('[contracts/contracts]: got gasPrice of ' + gasprice);
callback(null, gasprice);
});
return callback(null, self.contractsConfig.gasPrice);
},
function prepareContractsFromCompilation(gasPrice, callback) {
console.dir('[contracts/contracts]: using gasprice ' + gasPrice + ', prepare contracts from compilation');