Skip to content

Commit fe64764

Browse files
committed
add m
1 parent 706a29c commit fe64764

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

program/rust/src/validator.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,16 @@ fn checked_load_price_account(price_account_info: &[u8]) -> Option<&PriceAccount
158158
))
159159
}
160160

161-
pub const PUBLISHER_CAPS_DENOMINATOR: u64 = 1_000_000;
162-
163-
pub fn compute_publisher_stake_caps(account_datas: Vec<&[u8]>, timestamp: i64, z: u64) -> Vec<u8> {
161+
pub fn compute_publisher_stake_caps(
162+
account_datas: Vec<&[u8]>,
163+
timestamp: i64,
164+
m: u64,
165+
z: u64,
166+
) -> Vec<u8> {
164167
let mut publisher_caps: BTreeMap<Pubkey, u64> = BTreeMap::new();
165168
for account in account_datas {
166169
if let Some(price_account) = checked_load_price_account(account) {
167-
let cap: u64 = PUBLISHER_CAPS_DENOMINATOR
170+
let cap: u64 = m
168171
.checked_div(max(u64::from(price_account.num_), z))
169172
.unwrap_or(0);
170173
for i in 0..(price_account.num_ as usize) {
@@ -186,5 +189,6 @@ pub fn compute_publisher_stake_caps(account_datas: Vec<&[u8]>, timestamp: i64, z
186189
})
187190
.collect::<Vec<PublisherStakeCap>>()
188191
.into(),
189-
}.to_bytes()
192+
}
193+
.to_bytes()
190194
}

0 commit comments

Comments
 (0)