Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC-456 changing priority fee recommendation by removing the .5% increase of every request #13

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading