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(eth-sender): add bump of min 10% when resending txs to avoid "replacement transaction underpriced" #2422

Merged
merged 1 commit into from
Jul 10, 2024
Merged
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
8 changes: 7 additions & 1 deletion core/node/eth_sender/src/eth_fees_oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl GasAdjusterFeesOracle {
previous_sent_tx: &Option<TxHistory>,
time_in_mempool: u32,
) -> Result<EthFees, EthSenderError> {
let base_fee_per_gas = self.gas_adjuster.get_base_fee(time_in_mempool);
let mut base_fee_per_gas = self.gas_adjuster.get_base_fee(time_in_mempool);
if let Some(previous_sent_tx) = previous_sent_tx {
self.verify_base_fee_not_too_low_on_resend(
previous_sent_tx.id,
Expand All @@ -84,6 +84,12 @@ impl GasAdjusterFeesOracle {
priority_fee_per_gas,
(previous_sent_tx.priority_fee_per_gas * 6) / 5 + 1,
);

// same for base_fee_per_gas but 10%
base_fee_per_gas = max(
base_fee_per_gas,
previous_sent_tx.base_fee_per_gas + (previous_sent_tx.base_fee_per_gas / 10) + 1,
);
}

// Extra check to prevent sending transaction will extremely high priority fee.
Expand Down
Loading