File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,10 @@ use {
30
30
transaction_context:: TransactionAccount ,
31
31
} ,
32
32
std:: {
33
- collections:: {
33
+ cmp :: max , collections:: {
34
34
BTreeMap ,
35
35
HashMap ,
36
- } ,
37
- mem:: size_of,
36
+ } , mem:: size_of
38
37
} ,
39
38
} ;
40
39
@@ -159,12 +158,12 @@ fn checked_load_price_account(price_account_info: &[u8]) -> Option<&PriceAccount
159
158
160
159
pub const PUBLISHER_CAPS_DENOMINATOR : u64 = 1_000_000 ;
161
160
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 > {
163
162
let mut publisher_caps: BTreeMap < Pubkey , u64 > = BTreeMap :: new ( ) ;
164
163
for account in accounts {
165
164
if let Some ( price_account) = checked_load_price_account ( account) {
166
165
let cap: u64 = PUBLISHER_CAPS_DENOMINATOR
167
- . checked_div ( u64:: from ( price_account. num_ ) )
166
+ . checked_div ( max ( u64:: from ( price_account. num_ ) , z ) )
168
167
. unwrap_or ( 0 ) ;
169
168
for i in 0 ..( price_account. num_ as usize ) {
170
169
publisher_caps
You can’t perform that action at this time.
0 commit comments