Skip to content

Commit 650d42f

Browse files
authored
feat(eth-sender): add a cap to time_in_mempool (#2978)
Signed-off-by: tomg10 <lemures64@gmail.com>
1 parent 4ffbf42 commit 650d42f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/node/eth_sender/src/eth_fees_oracle.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ impl GasAdjusterFeesOracle {
8282
previous_sent_tx: &Option<TxHistory>,
8383
time_in_mempool: u32,
8484
) -> Result<EthFees, EthSenderError> {
85-
let mut base_fee_per_gas = self.gas_adjuster.get_base_fee(time_in_mempool);
85+
// cap it at 6h to not allow nearly infinite values when a tx is stuck for a long time
86+
let capped_time_in_mempool = min(time_in_mempool, 1800);
87+
let mut base_fee_per_gas = self.gas_adjuster.get_base_fee(capped_time_in_mempool);
8688
self.assert_fee_is_not_zero(base_fee_per_gas, "base");
8789
if let Some(previous_sent_tx) = previous_sent_tx {
8890
self.verify_base_fee_not_too_low_on_resend(

0 commit comments

Comments
 (0)