Skip to content

Commit 6e99953

Browse files
fix: use modified tx_req in update_gas_fees
1 parent 31807fb commit 6e99953

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

  • aggregation_mode/proof_aggregator/src/backend

aggregation_mode/proof_aggregator/src/backend/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,7 @@ impl ProofAggregator {
505505

506506
let mut current_tx_req = tx_req.clone();
507507

508-
// Obtain the current gas price if not set
509-
if tx_req.max_fee_per_gas.is_none() {
508+
if current_tx_req.max_fee_per_gas.is_none() {
510509
let current_gas_price = provider.get_gas_price().await.map_err(|e| {
511510
RetryError::Transient(AggregatedProofSubmissionError::GasPriceError(e.to_string()))
512511
})?;
@@ -518,14 +517,13 @@ impl ProofAggregator {
518517
.with_max_fee_per_gas(new_max_fee)
519518
.with_max_priority_fee_per_gas(new_priority_fee);
520519
} else {
521-
// If set, multiplicate the current ones
522-
if let Some(max_fee) = tx_req.max_fee_per_gas {
520+
if let Some(max_fee) = current_tx_req.max_fee_per_gas {
523521
let new_max_fee = (max_fee as f64 * multiplier) as u128;
524-
current_tx_req = tx_req.clone().with_max_fee_per_gas(new_max_fee);
522+
current_tx_req = current_tx_req.with_max_fee_per_gas(new_max_fee);
525523
}
526-
if let Some(priority_fee) = tx_req.max_priority_fee_per_gas {
527-
let new_priority_fee = (priority_fee as f64 * multiplier * 0.1) as u128;
528-
current_tx_req = tx_req.with_max_priority_fee_per_gas(new_priority_fee);
524+
if let Some(priority_fee) = current_tx_req.max_priority_fee_per_gas {
525+
let new_priority_fee = (priority_fee as f64 * multiplier) as u128;
526+
current_tx_req = current_tx_req.with_max_priority_fee_per_gas(new_priority_fee);
529527
}
530528
}
531529

0 commit comments

Comments
 (0)