Skip to content

Commit

Permalink
add z
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos committed Jul 18, 2024
1 parent a0b470b commit 14c719d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions program/rust/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ use {
transaction_context::TransactionAccount,
},
std::{
collections::{
cmp::max, collections::{
BTreeMap,
HashMap,
},
mem::size_of,
}, mem::size_of
},
};

Expand Down Expand Up @@ -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<u8> {
pub fn compute_publisher_stake_caps(accounts: Vec<&[u8]>, timestamp: i64, z : u64) -> Vec<u8> {
let mut publisher_caps: BTreeMap<Pubkey, u64> = 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
Expand Down

0 comments on commit 14c719d

Please sign in to comment.