Skip to content

Commit

Permalink
RPC-456 changing priority fee recommendation by removing the .5% incr…
Browse files Browse the repository at this point in the history
…ease of every request
  • Loading branch information
dmitriy-helius committed Sep 23, 2024
1 parent 19ec27e commit aac3969
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,17 +498,13 @@ fn should_include_vote(options: &Option<GetPriorityFeeEstimateOptions>) -> bool

const MIN_RECOMMENDED_PRIORITY_FEE: f64 = 10_000.0;

// Safety buffer on the recommended fee to cover cases where the priority fee is increasing over each block.
const RECOMMENDED_FEE_SAFETY_BUFFER: f64 = 0.05;

pub fn get_recommended_fee(priority_fee_levels: MicroLamportPriorityFeeEstimates) -> f64 {
let recommended = if priority_fee_levels.medium > MIN_RECOMMENDED_PRIORITY_FEE {
priority_fee_levels.medium
} else {
MIN_RECOMMENDED_PRIORITY_FEE
};
let recommended_with_buffer = recommended * (1.0 + RECOMMENDED_FEE_SAFETY_BUFFER);
recommended_with_buffer.ceil()
recommended.ceil()
}

#[cfg(test)]
Expand Down Expand Up @@ -635,7 +631,7 @@ mod tests {
});
let resp = result.unwrap();
assert!(resp.priority_fee_levels.is_none());
assert_eq!(resp.priority_fee_estimate, Some(10500.0));
assert_eq!(resp.priority_fee_estimate, Some(10000.0));
}

#[test]
Expand Down

0 comments on commit aac3969

Please sign in to comment.