@@ -30,10 +30,12 @@ use {
30
30
transaction_context:: TransactionAccount ,
31
31
} ,
32
32
std:: {
33
- cmp:: max, collections:: {
33
+ cmp:: max,
34
+ collections:: {
34
35
BTreeMap ,
35
36
HashMap ,
36
- } , mem:: size_of
37
+ } ,
38
+ mem:: size_of,
37
39
} ,
38
40
} ;
39
41
@@ -158,9 +160,9 @@ fn checked_load_price_account(price_account_info: &[u8]) -> Option<&PriceAccount
158
160
159
161
pub const PUBLISHER_CAPS_DENOMINATOR : u64 = 1_000_000 ;
160
162
161
- pub fn compute_publisher_stake_caps ( accounts : Vec < & [ u8 ] > , timestamp : i64 , z : u64 ) -> Vec < u8 > {
163
+ pub fn compute_publisher_stake_caps ( account_datas : Vec < & [ u8 ] > , timestamp : i64 , z : u64 ) -> Vec < u8 > {
162
164
let mut publisher_caps: BTreeMap < Pubkey , u64 > = BTreeMap :: new ( ) ;
163
- for account in accounts {
165
+ for account in account_datas {
164
166
if let Some ( price_account) = checked_load_price_account ( account) {
165
167
let cap: u64 = PUBLISHER_CAPS_DENOMINATOR
166
168
. checked_div ( max ( u64:: from ( price_account. num_ ) , z) )
@@ -174,7 +176,7 @@ pub fn compute_publisher_stake_caps(accounts: Vec<&[u8]>, timestamp: i64, z : u6
174
176
}
175
177
}
176
178
177
- let message = PublisherStakeCapsMessage {
179
+ PublisherStakeCapsMessage {
178
180
publish_time : timestamp,
179
181
caps : publisher_caps
180
182
. into_iter ( )
@@ -184,7 +186,5 @@ pub fn compute_publisher_stake_caps(accounts: Vec<&[u8]>, timestamp: i64, z : u6
184
186
} )
185
187
. collect :: < Vec < PublisherStakeCap > > ( )
186
188
. into ( ) ,
187
- } ;
188
-
189
- return message. to_bytes ( ) ;
189
+ } . to_bytes ( )
190
190
}
0 commit comments