Skip to content

Commit 14c719d

Browse files
committed
add z
1 parent a0b470b commit 14c719d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

program/rust/src/validator.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ use {
3030
transaction_context::TransactionAccount,
3131
},
3232
std::{
33-
collections::{
33+
cmp::max, collections::{
3434
BTreeMap,
3535
HashMap,
36-
},
37-
mem::size_of,
36+
}, mem::size_of
3837
},
3938
};
4039

@@ -159,12 +158,12 @@ fn checked_load_price_account(price_account_info: &[u8]) -> Option<&PriceAccount
159158

160159
pub const PUBLISHER_CAPS_DENOMINATOR: u64 = 1_000_000;
161160

162-
pub fn compute_publisher_stake_caps(accounts: Vec<&[u8]>, timestamp: i64) -> Vec<u8> {
161+
pub fn compute_publisher_stake_caps(accounts: Vec<&[u8]>, timestamp: i64, z : u64) -> Vec<u8> {
163162
let mut publisher_caps: BTreeMap<Pubkey, u64> = BTreeMap::new();
164163
for account in accounts {
165164
if let Some(price_account) = checked_load_price_account(account) {
166165
let cap: u64 = PUBLISHER_CAPS_DENOMINATOR
167-
.checked_div(u64::from(price_account.num_))
166+
.checked_div(max(u64::from(price_account.num_), z))
168167
.unwrap_or(0);
169168
for i in 0..(price_account.num_ as usize) {
170169
publisher_caps

0 commit comments

Comments
 (0)