diff --git a/program/rust/src/validator.rs b/program/rust/src/validator.rs index 8f347621..2591113b 100644 --- a/program/rust/src/validator.rs +++ b/program/rust/src/validator.rs @@ -30,11 +30,10 @@ use { transaction_context::TransactionAccount, }, std::{ - collections::{ + cmp::max, collections::{ BTreeMap, HashMap, - }, - mem::size_of, + }, mem::size_of }, }; @@ -159,12 +158,12 @@ fn checked_load_price_account(price_account_info: &[u8]) -> Option<&PriceAccount pub const PUBLISHER_CAPS_DENOMINATOR: u64 = 1_000_000; -pub fn compute_publisher_stake_caps(accounts: Vec<&[u8]>, timestamp: i64) -> Vec { +pub fn compute_publisher_stake_caps(accounts: Vec<&[u8]>, timestamp: i64, z : u64) -> Vec { let mut publisher_caps: BTreeMap = BTreeMap::new(); for account in accounts { if let Some(price_account) = checked_load_price_account(account) { let cap: u64 = PUBLISHER_CAPS_DENOMINATOR - .checked_div(u64::from(price_account.num_)) + .checked_div(max(u64::from(price_account.num_), z)) .unwrap_or(0); for i in 0..(price_account.num_ as usize) { publisher_caps