Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ index_list = { workspace = true }
itertools = { workspace = true }
lazy_static = { workspace = true }
log = { workspace = true }
lru = { workspace = true }
lz4 = { workspace = true }
memmap2 = { workspace = true }
mockall = { workspace = true }
Expand Down
23 changes: 6 additions & 17 deletions runtime/src/prioritization_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,17 @@ impl Default for PrioritizationFee {

impl PrioritizationFee {
/// Update self for minimum transaction fee in the block and minimum fee for each writable account.
pub fn update(
&mut self,
transaction_fee: u64,
writable_accounts: &[Pubkey],
) -> Result<(), PrioritizationFeeError> {
pub fn update(&mut self, transaction_fee: u64, writable_accounts: Vec<Pubkey>) {
let (_, update_time) = measure!(
{
if !self.is_finalized {
if transaction_fee < self.min_transaction_fee {
self.min_transaction_fee = transaction_fee;
}

for write_account in writable_accounts.iter() {
for write_account in writable_accounts {
self.min_writable_account_fees
.entry(*write_account)
.entry(write_account)
.and_modify(|write_lock_fee| {
*write_lock_fee = std::cmp::min(*write_lock_fee, transaction_fee)
})
Expand All @@ -199,7 +195,6 @@ impl PrioritizationFee {

self.metrics
.accumulate_total_update_elapsed_us(update_time.as_us());
Ok(())
}

/// Accounts that have minimum fees lesser or equal to the minimum fee in the block are redundant, they are
Expand Down Expand Up @@ -283,9 +278,7 @@ mod tests {
// -----------------------------------------------------------------------
// [5, a, b ] --> [5, 5, 5, nil ]
{
assert!(prioritization_fee
.update(5, &[write_account_a, write_account_b])
.is_ok());
prioritization_fee.update(5, vec![write_account_a, write_account_b]);
assert_eq!(5, prioritization_fee.get_min_transaction_fee().unwrap());
assert_eq!(
5,
Expand All @@ -309,9 +302,7 @@ mod tests {
// -----------------------------------------------------------------------
// [9, b, c ] --> [5, 5, 5, 9 ]
{
assert!(prioritization_fee
.update(9, &[write_account_b, write_account_c])
.is_ok());
prioritization_fee.update(9, vec![write_account_b, write_account_c]);
assert_eq!(5, prioritization_fee.get_min_transaction_fee().unwrap());
assert_eq!(
5,
Expand All @@ -338,9 +329,7 @@ mod tests {
// -----------------------------------------------------------------------
// [2, a, c ] --> [2, 2, 5, 2 ]
{
assert!(prioritization_fee
.update(2, &[write_account_a, write_account_c])
.is_ok());
prioritization_fee.update(2, vec![write_account_a, write_account_c]);
assert_eq!(2, prioritization_fee.get_min_transaction_fee().unwrap());
assert_eq!(
2,
Expand Down
Loading