File tree Expand file tree Collapse file tree 3 files changed +5
-34
lines changed Expand file tree Collapse file tree 3 files changed +5
-34
lines changed Original file line number Diff line number Diff line change 1313 instruction:: UpdPriceArgs ,
1414 utils:: {
1515 check_valid_funding_account,
16- check_valid_writable_account_without_rent_check ,
16+ check_valid_writable_account ,
1717 get_status_for_conf_price_ratio,
1818 is_component_update,
1919 pyth_assert,
@@ -123,7 +123,7 @@ pub fn upd_price(
123123 } ?;
124124
125125 check_valid_funding_account ( funding_account) ?;
126- check_valid_writable_account_without_rent_check ( program_id, price_account) ?;
126+ check_valid_writable_account ( program_id, price_account) ?;
127127 // Check clock
128128 let clock = Clock :: from_account_info ( clock_account) ?;
129129
Original file line number Diff line number Diff line change @@ -58,21 +58,7 @@ fn test_add_publisher() {
5858 permissions_account_data. security_authority = * funding_account. key ;
5959 }
6060
61- // Expect the instruction to fail, because the price account isn't rent exempt
62- assert_eq ! (
63- process_instruction(
64- & program_id,
65- & [
66- funding_account. clone( ) ,
67- price_account. clone( ) ,
68- permissions_account. clone( ) ,
69- ] ,
70- instruction_data
71- ) ,
72- Err ( OracleError :: InvalidWritableAccount . into( ) )
73- ) ;
74-
75- // Now give the price account enough lamports to be rent exempt
61+ // Give the price account enough lamports to be rent exempt
7662 * * price_account. try_borrow_mut_lamports ( ) . unwrap ( ) =
7763 Rent :: minimum_balance ( & Rent :: default ( ) , PriceAccount :: MINIMUM_SIZE ) ;
7864
Original file line number Diff line number Diff line change @@ -115,9 +115,7 @@ fn valid_writable_account(
115115 program_id : & Pubkey ,
116116 account : & AccountInfo ,
117117) -> Result < bool , ProgramError > {
118- Ok ( account. is_writable
119- && account. owner == program_id
120- && get_rent ( ) ?. is_exempt ( account. lamports ( ) , account. data_len ( ) ) )
118+ Ok ( account. is_writable && account. owner == program_id)
121119}
122120
123121pub fn check_valid_writable_account (
@@ -130,24 +128,11 @@ pub fn check_valid_writable_account(
130128 )
131129}
132130
133- pub fn check_valid_writable_account_without_rent_check (
134- program_id : & Pubkey ,
135- account : & AccountInfo ,
136- ) -> Result < ( ) , ProgramError > {
137- pyth_assert (
138- account. is_writable && account. owner == program_id,
139- OracleError :: InvalidWritableAccount . into ( ) ,
140- )
141- }
142-
143131fn valid_readable_account (
144132 program_id : & Pubkey ,
145133 account : & AccountInfo ,
146134) -> Result < bool , ProgramError > {
147- Ok (
148- account. owner == program_id
149- && get_rent ( ) ?. is_exempt ( account. lamports ( ) , account. data_len ( ) ) ,
150- )
135+ Ok ( account. owner == program_id)
151136}
152137
153138pub fn check_valid_readable_account (
You can’t perform that action at this time.
0 commit comments