Skip to content

Commit 3e7a81d

Browse files
committed
use only one match
1 parent edc1e92 commit 3e7a81d

File tree

1 file changed

+5
-16
lines changed
  • crates/networking/rpc/clients/eth

1 file changed

+5
-16
lines changed

crates/networking/rpc/clients/eth/mod.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -210,24 +210,13 @@ impl EthClient {
210210
'outer: while number_of_retries < MAX_NUMBER_OF_RETRIES {
211211
if let Some(max_fee_per_gas) = self.maximum_allowed_max_fee_per_gas {
212212
let tx_max_fee = match wrapped_tx {
213-
WrappedTransaction::EIP4844(tx) => tx.tx.max_fee_per_gas,
214-
WrappedTransaction::EIP1559(tx) => tx.max_fee_per_gas,
215-
WrappedTransaction::L2(tx) => tx.max_fee_per_gas,
213+
WrappedTransaction::EIP4844(tx) => &mut tx.tx.max_fee_per_gas,
214+
WrappedTransaction::EIP1559(tx) => &mut tx.max_fee_per_gas,
215+
WrappedTransaction::L2(tx) => &mut tx.max_fee_per_gas,
216216
};
217217

218-
if tx_max_fee > max_fee_per_gas {
219-
match wrapped_tx {
220-
WrappedTransaction::EIP4844(tx) => {
221-
tx.tx.max_fee_per_gas = max_fee_per_gas;
222-
}
223-
WrappedTransaction::EIP1559(tx) => {
224-
tx.max_fee_per_gas = max_fee_per_gas;
225-
}
226-
WrappedTransaction::L2(tx) => {
227-
tx.max_fee_per_gas = max_fee_per_gas;
228-
}
229-
}
230-
218+
if *tx_max_fee > max_fee_per_gas {
219+
*tx_max_fee = max_fee_per_gas;
231220
warn!("max_fee_per_gas exceeds the allowed limit, adjusting it to {max_fee_per_gas}");
232221
}
233222
}

0 commit comments

Comments
 (0)