Skip to content

Commit 278a003

Browse files
committed
eth gas limit #2112
1 parent 8b2b2cc commit 278a003

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crypto/blockchains/eth/EthTransferProcessor.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,11 @@ export default class EthTransferProcessor extends EthBasic implements BlocksoftB
162162
try {
163163
let ok = false
164164
let i = 0
165+
let gasLimitNew = false
165166
do {
166167
try {
167168
i++
168-
gasLimit = await EthEstimateGas(this._web3.LINK, gasPrice.speed_blocks_2 || gasPrice.speed_blocks_12, data.addressFrom, data.addressTo, data.amount) // it doesn't matter what the price of gas is, just a required parameter
169+
gasLimitNew = await EthEstimateGas(this._web3.LINK, gasPrice.speed_blocks_2 || gasPrice.speed_blocks_12, data.addressFrom, data.addressTo, data.amount) // it doesn't matter what the price of gas is, just a required parameter
169170
BlocksoftCryptoLog.log(this._settings.currencyCode + ' EthTransferProcessor.getFeeRate estimatedGas ' + gasLimit)
170171
} catch (e1) {
171172
ok = false
@@ -174,6 +175,9 @@ export default class EthTransferProcessor extends EthBasic implements BlocksoftB
174175
}
175176
}
176177
} while (!ok && i <= 5)
178+
if (gasLimitNew && typeof gasLimitNew !== 'undefined' && gasLimitNew * 1 > 0) {
179+
gasLimit = gasLimitNew * 1
180+
}
177181
} catch (e) {
178182
if (e.message.indexOf('resolve host') !== -1) {
179183
throw new Error('SERVER_RESPONSE_NOT_CONNECTED')
@@ -200,7 +204,6 @@ export default class EthTransferProcessor extends EthBasic implements BlocksoftB
200204
} catch (e) {
201205
throw new Error(e.message + ' in get gasLimit')
202206
}
203-
console.log(new Date().toISOString() + ' end estimation')
204207

205208
let showBigGasNotice = false
206209
if (typeof additionalData === 'undefined' || typeof additionalData.isCustomFee === 'undefined' || !additionalData.isCustomFee) {
@@ -215,7 +218,7 @@ export default class EthTransferProcessor extends EthBasic implements BlocksoftB
215218
}
216219

217220
if (!gasLimit) {
218-
throw new Error('invalid transaction (no gas limit)')
221+
throw new Error('invalid transaction (no gas limit.2)')
219222
}
220223

221224
// @ts-ignore

0 commit comments

Comments
 (0)