From 306ea4a14ba8da47e3bda399a30f1683f026661e Mon Sep 17 00:00:00 2001 From: Agustin Pane Date: Tue, 2 Feb 2021 12:39:54 -0300 Subject: [PATCH] Check that the estimation of the node is bigger than 0 before returning --- src/logic/safe/transactions/gas.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/logic/safe/transactions/gas.ts b/src/logic/safe/transactions/gas.ts index bcee4537..c7e54e0b 100644 --- a/src/logic/safe/transactions/gas.ts +++ b/src/logic/safe/transactions/gas.ts @@ -182,15 +182,17 @@ const calculateMinimumGasForTransaction = async ( const amountOfGasToTryTx = txGasEstimation + dataGasEstimation + additionalGas console.info(`Estimating transaction creation with gas amount: ${amountOfGasToTryTx}`) try { - await getGasEstimationTxResponse({ + const estimation = await getGasEstimationTxResponse({ to: safeAddress, from: safeAddress, data: estimateData, gasPrice: 0, gas: amountOfGasToTryTx, }) - console.info(`Gas estimation successfully finished with gas amount: ${amountOfGasToTryTx}`) - return amountOfGasToTryTx + if (estimation > 0) { + console.info(`Gas estimation successfully finished with gas amount: ${amountOfGasToTryTx}`) + return amountOfGasToTryTx + } } catch (error) { console.log(`Error trying to estimate gas with amount: ${amountOfGasToTryTx}`) }