From 5f9537cb8d8ae4aed59f202e751ed598c7f492bd Mon Sep 17 00:00:00 2001 From: David Murdoch Date: Tue, 30 Apr 2019 17:11:26 -0400 Subject: [PATCH] Gas estimation: make sure we always return a `lowestIndex` for a range (#421) --- lib/utils/gasEstimation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/gasEstimation.js b/lib/utils/gasEstimation.js index f3e4f191de..29020666c9 100644 --- a/lib/utils/gasEstimation.js +++ b/lib/utils/gasEstimation.js @@ -119,7 +119,7 @@ module.exports = (vm, runArgs, err, callback) => { */ const findLowestIndex = (start, stop) => { let lowestGas = Infinity; - let lowestIndex; + let lowestIndex = stop; for (let i = start; i <= stop; i++) { if (steps.ops[i].gasLeft <= lowestGas) { // Find the new lowest gas index