Skip to content

Commit

Permalink
Make get_prioritization_fee public
Browse files Browse the repository at this point in the history
  • Loading branch information
ksolana committed Nov 2, 2024
1 parent 8e54e04 commit 25d6058
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
7 changes: 1 addition & 6 deletions compute-budget/src/compute_budget_limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ impl Default for ComputeBudgetLimits {
}
}

//#[cfg(test)]
pub fn get_prioritization_fee_for_test(compute_unit_price: u64, compute_unit_limit: u64) -> u64 {
get_prioritization_fee(compute_unit_price, compute_unit_limit)
}

fn get_prioritization_fee(compute_unit_price: u64, compute_unit_limit: u64) -> u64 {
pub fn get_prioritization_fee(compute_unit_price: u64, compute_unit_limit: u64) -> u64 {
let micro_lamport_fee: MicroLamports =
(compute_unit_price as u128).saturating_mul(compute_unit_limit as u128);
micro_lamport_fee
Expand Down
10 changes: 3 additions & 7 deletions runtime/src/bank/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use {
},
solana_compute_budget::{
compute_budget::ComputeBudget,
compute_budget_limits::{self, get_prioritization_fee_for_test, MAX_COMPUTE_UNIT_LIMIT},
compute_budget_limits::{self, get_prioritization_fee, MAX_COMPUTE_UNIT_LIMIT},
},
solana_feature_set::{self as feature_set, FeatureSet},
solana_inline_spl::token,
Expand Down Expand Up @@ -10314,10 +10314,7 @@ fn test_calculate_fee_compute_units() {
assert_eq!(
fee,
lamports_per_signature
+ get_prioritization_fee_for_test(
PRIORITIZATION_FEE_RATE,
requested_compute_units as u64
)
+ get_prioritization_fee(PRIORITIZATION_FEE_RATE, requested_compute_units as u64)
);
}
}
Expand All @@ -10331,8 +10328,7 @@ fn test_calculate_prioritization_fee() {

let request_units = 1_000_000_u32;
let request_unit_price = 2_000_000_000_u64;
let prioritization_fee =
get_prioritization_fee_for_test(request_unit_price, request_units as u64);
let prioritization_fee = get_prioritization_fee(request_unit_price, request_units as u64);

let message = new_sanitized_message(Message::new(
&[
Expand Down

0 comments on commit 25d6058

Please sign in to comment.