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

Add 20% gas price buffer to legacy transactions #84

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
10 changes: 10 additions & 0 deletions lib/ethers/transaction.ex
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@ defmodule Ethers.Transaction do
end
end

defp do_post_process(:gas_price, {:ok, v_hex}) do
with {:ok, v} <- Utils.hex_to_integer(v_hex) do
# Setting a higher value for gas_price gas since the actual base fee is
# determined by the last block. This way we minimize the chance to get stuck in
# queue when base fee increases
mex_fee_per_gas = div(v * 120, 100)
{:ok, {:gas_price, Utils.integer_to_hex(mex_fee_per_gas)}}
end
end

defp do_post_process(key, {:ok, v_hex}) do
{:ok, {key, v_hex}}
end
Expand Down
Loading