Skip to content

Commit

Permalink
Fix/block gas limit exceeded #2 (celo-org#2263)
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D authored and celo-ci-bot-user committed Dec 17, 2019
1 parent ef58954 commit 9ab55eb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/protocol/lib/web3-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export async function sendTransactionWithPrivateKey<T>(
// Encode data and estimate gas or use default values for a transfer.
let encodedTxData: string|undefined
let estimatedGas = 21000 // Gas cost of a basic transfer.

if (tx !== null) {
encodedTxData = tx.encodeABI()
estimatedGas = await tx.estimateGas({
Expand All @@ -35,7 +36,9 @@ export async function sendTransactionWithPrivateKey<T>(
...txArgs,
data: encodedTxData,
from: address,
gas: estimatedGas * 10,
// make sure to use enough gas but dont overspend
// or we will run into "block gas limit exceeded" errors
gas: estimatedGas * 2,
},
privateKey
)
Expand Down

0 comments on commit 9ab55eb

Please sign in to comment.