Skip to main content

estimate_priority_fee

Function estimate_priority_fee 

Source
fn estimate_priority_fee(rewards: &[Vec<u128>], gas_used_ratio: &[f64]) -> u128
Expand description

Estimates the priority fee as the median of the non-zero per-block rewards, never returning less than MIN_PRIORITY_FEE.

Rewards from blocks below MIN_GAS_USED_RATIO are dropped first so one-off tips in idle blocks do not dominate the median. If that empties the sample but at least half the blocks still carry a tip, the unfiltered median is used instead, so chronically light chains do not collapse to MIN_PRIORITY_FEE. The filter is skipped when gas_used_ratio does not line up with rewards (e.g. gasUsedRatio: null, which alloy deserializes as an empty vec).