Skip to content

Commit d0162a6

Browse files
committed
move - for now - determining gas price to deployment to avoid race conditions
1 parent 296663e commit d0162a6

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lib/contracts/contract_deployer.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ class ContractDeployer {
199199
function applyBeforeDeploy(next) {
200200
self.plugins.emitAndRunActionsForEvent('deploy:contract:beforeDeploy', {contract: contract}, next);
201201
},
202+
function getGasPriceForNetwork(next) {
203+
self.events.request("blockchain:gasPrice", (gasPrice) => {
204+
console.dir('[contracts/contracts]: got gasPrice of ' + gasPrice);
205+
contract.gasPrice = contract.gasPrice || gasPrice;
206+
next();
207+
});
208+
},
202209
function createDeployObject(next) {
203210
let contractObject = self.blockchain.ContractObject({abi: contract.abiDefinition});
204211

lib/contracts/contracts.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,7 @@ class ContractsManager {
9595
},
9696
function getGasPriceForNetwork(callback) {
9797
console.dir('[contracts/contracts]: gas price for network, passed in gasPrice from config: ' + self.contractsConfig.gasPrice);
98-
if (self.contractsConfig.gasPrice) {
99-
return callback(null, self.contractsConfig.gasPrice);
100-
}
101-
self.events.request("blockchain:gasPrice", (gasprice) => {
102-
console.dir('[contracts/contracts]: got gasPrice of ' + gasprice);
103-
callback(null, gasprice);
104-
});
98+
return callback(null, self.contractsConfig.gasPrice);
10599
},
106100
function prepareContractsFromCompilation(gasPrice, callback) {
107101
console.dir('[contracts/contracts]: using gasprice ' + gasPrice + ', prepare contracts from compilation');

0 commit comments

Comments
 (0)