Skip to content

Commit

Permalink
feat(eth-sender): add a cap to time_in_mempool (matter-labs#2978)
Browse files Browse the repository at this point in the history
Signed-off-by: tomg10 <lemures64@gmail.com>
  • Loading branch information
tomg10 authored Sep 27, 2024
1 parent 4ffbf42 commit 650d42f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/node/eth_sender/src/eth_fees_oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ impl GasAdjusterFeesOracle {
previous_sent_tx: &Option<TxHistory>,
time_in_mempool: u32,
) -> Result<EthFees, EthSenderError> {
let mut base_fee_per_gas = self.gas_adjuster.get_base_fee(time_in_mempool);
// cap it at 6h to not allow nearly infinite values when a tx is stuck for a long time
let capped_time_in_mempool = min(time_in_mempool, 1800);
let mut base_fee_per_gas = self.gas_adjuster.get_base_fee(capped_time_in_mempool);
self.assert_fee_is_not_zero(base_fee_per_gas, "base");
if let Some(previous_sent_tx) = previous_sent_tx {
self.verify_base_fee_not_too_low_on_resend(
Expand Down

0 comments on commit 650d42f

Please sign in to comment.