From 135c3c06a7190815cc56f65a6222557fdec07284 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 6 Feb 2017 21:34:10 -0500 Subject: [PATCH] finclude transaction cost in gas estimation --- lib/contracts.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/contracts.js b/lib/contracts.js index 5fd10a78..369fdb45 100644 --- a/lib/contracts.js +++ b/lib/contracts.js @@ -7,8 +7,9 @@ var async = require('async'); var adjustGas = function(contract) { var maxGas, adjustedGas; if (contract.gas === 'auto') { - if (contract.deploy) { + if (contract.deploy || contract.deploy === undefined) { if (contract.gasEstimates.creation !== undefined) { + // TODO: should sum it instead maxGas = Math.max(contract.gasEstimates.creation[0], contract.gasEstimates.creation[1], 500000); } else { maxGas = 500000; @@ -17,7 +18,8 @@ var adjustGas = function(contract) { maxGas = 500000; } // TODO: put a check so it doesn't go over the block limit - adjustedGas = Math.round(maxGas * 1.40); + adjustedGas = Math.round(maxGas * 1.40); + adjustedGas += 25000; contract.gas = adjustedGas; } };