Commit 7fee01d0 authored by yann300's avatar yann300

add a warn label (about gas estimation)

parent eb73cb39
...@@ -56,12 +56,15 @@ TxRunner.prototype.execute = function (args, callback) { ...@@ -56,12 +56,15 @@ TxRunner.prototype.execute = function (args, callback) {
var blockGasLimit = executionContext.currentblockGasLimit() var blockGasLimit = executionContext.currentblockGasLimit()
// NOTE: estimateGas very likely will return a large limit if execution of the code failed // NOTE: estimateGas very likely will return a large limit if execution of the code failed
// we want to be able to run the code in order to debug and find the cause for the failure // we want to be able to run the code in order to debug and find the cause for the failure
var warnEstimation = ' An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that\'s also the reason of strong gas estimation).'
if (gasEstimation > gasLimit) { if (gasEstimation > gasLimit) {
return callback('Gas required exceeds limit: ' + gasLimit) return callback('Gas required exceeds limit: ' + gasLimit + '. ' + warnEstimation)
} }
if (gasEstimation > blockGasLimit) { if (gasEstimation > blockGasLimit) {
return callback('Gas required exceeds block gas limit: ' + gasLimit) return callback('Gas required exceeds block gas limit: ' + gasLimit + '. ' + warnEstimation)
} }
tx.gas = gasEstimation tx.gas = gasEstimation
var sendTransaction = self.personalMode ? executionContext.web3().personal.sendTransaction : executionContext.web3().eth.sendTransaction var sendTransaction = self.personalMode ? executionContext.web3().personal.sendTransaction : executionContext.web3().eth.sendTransaction
try { try {
......
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