@@ -10,6 +10,7 @@ use crate::c_oracle_header::{
1010 PriceEma ,
1111 PriceInfo ,
1212 ProductAccount ,
13+ PythAccount ,
1314 MAX_CI_DIVISOR ,
1415 PC_COMP_SIZE ,
1516 PC_MAP_TABLE_SIZE ,
@@ -60,9 +61,6 @@ use solana_program::system_instruction::transfer;
6061use solana_program:: system_program:: check_id;
6162use solana_program:: sysvar:: Sysvar ;
6263
63- const PRICE_T_SIZE : usize = size_of :: < PriceAccount > ( ) ;
64- const PRICE_ACCOUNT_SIZE : usize = size_of :: < PriceAccountWrapper > ( ) ;
65-
6664
6765#[ cfg( target_arch = "bpf" ) ]
6866#[ link( name = "cpyth-bpf" ) ]
@@ -116,7 +114,7 @@ pub fn resize_price_account(
116114 }
117115 let account_len = price_account_info. try_data_len ( ) ?;
118116 match account_len {
119- PRICE_T_SIZE => {
117+ PriceAccount :: MINIMUM_SIZE => {
120118 // Ensure account is still rent exempt after resizing
121119 let rent: Rent = Default :: default ( ) ;
122120 let lamports_needed: u64 = rent
@@ -142,7 +140,7 @@ pub fn resize_price_account(
142140 price_account. initialize_time_machine ( ) ?;
143141 Ok ( ( ) )
144142 }
145- PRICE_ACCOUNT_SIZE => Ok ( ( ) ) ,
143+ PriceAccountWrapper :: MINIMUM_SIZE => Ok ( ( ) ) ,
146144 _ => Err ( ProgramError :: InvalidArgument ) ,
147145 }
148146}
@@ -264,7 +262,7 @@ pub fn upd_price(
264262 }
265263
266264 let account_len = price_account. try_data_len ( ) ?;
267- if aggregate_updated && account_len == PRICE_ACCOUNT_SIZE {
265+ if aggregate_updated && account_len == PriceAccountWrapper :: MINIMUM_SIZE {
268266 let mut price_account =
269267 load_checked :: < PriceAccountWrapper > ( price_account, cmd_args. header . version ) ?;
270268 price_account. add_price_to_time_machine ( ) ?;
0 commit comments