Skip to content

Commit

Permalink
Add saturating sub to calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Ventura committed Feb 6, 2025
1 parent a980c6e commit cad1e1e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/common/types/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,13 @@ impl Transaction {
}

fn calc_effective_gas_price(&self, base_fee_per_gas: Option<u64>) -> Option<u64> {
// dbg!(base_fee_per_gas);
// dbg!(self.max_priority_fee()?);
// dbg!(self.max_fee_per_gas()?);

let priority_fee_per_gas = min(
self.max_priority_fee()?,
self.max_fee_per_gas()? - base_fee_per_gas?,
self.max_fee_per_gas()?.saturating_sub(base_fee_per_gas?),
);
Some(priority_fee_per_gas + base_fee_per_gas?)
}
Expand Down

0 comments on commit cad1e1e

Please sign in to comment.