Commit 5c98506f authored by yann300's avatar yann300 Committed by Alex Beregszaszi

rename resp -> gasEstimation

parent 1d297a10
...@@ -65,16 +65,16 @@ TxRunner.prototype.execute = function () { ...@@ -65,16 +65,16 @@ TxRunner.prototype.execute = function () {
}) })
}) })
} else { } else {
self.web3.eth.estimateGas(tx, function (err, resp) { self.web3.eth.estimateGas(tx, function (err, gasEstimation) {
if (err) { if (err) {
return callback(err, resp) return callback(err, gasEstimation)
} }
self.web3.eth.getBlock('latest', function (err, block) { self.web3.eth.getBlock('latest', function (err, block) {
if (err) { if (err) {
return callback(err) return callback(err)
} else { } else {
var blockGasLimit = Math.floor(block.gasLimit - block.gasLimit / 1024) var blockGasLimit = Math.floor(block.gasLimit - block.gasLimit / 1024)
tx.gas = blockGasLimit < resp ? blockGasLimit : resp tx.gas = blockGasLimit < gasEstimation ? blockGasLimit : gasEstimation
if (tx.gas > gasLimit) { if (tx.gas > gasLimit) {
return callback('Gas required exceeds limit: ' + tx.gas) return callback('Gas required exceeds limit: ' + tx.gas)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment