Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/block gas limit exceeded #2 #2263

Merged
merged 5 commits into from
Dec 17, 2019
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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