Skip to content

Commit 923e4ae

Browse files
authored
[size-hack] Remove clear account (#362)
* Remove clear account * Fix imports
1 parent 96da017 commit 923e4ae

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

program/rust/src/accounts.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,20 @@ use {
2020
account_info::AccountInfo,
2121
program::invoke_signed,
2222
program_error::ProgramError,
23-
program_memory::sol_memset,
2423
pubkey::Pubkey,
2524
system_instruction::create_account,
2625
},
2726
std::{
28-
borrow::BorrowMut,
2927
cell::RefMut,
3028
mem::size_of,
3129
},
3230
};
31+
#[cfg(test)]
32+
use {
33+
solana_program::program_memory::sol_memset,
34+
std::borrow::BorrowMut,
35+
};
36+
3337

3438
mod mapping;
3539
mod permission;
@@ -109,7 +113,6 @@ pub trait PythAccount: Pod {
109113
)?;
110114

111115
check_valid_fresh_account(account)?;
112-
clear_account(account)?;
113116

114117
{
115118
let mut account_header = load_account_as_mut::<AccountHeader>(account)?;
@@ -170,6 +173,7 @@ fn create<'a>(
170173
}
171174

172175
/// Sets the data of account to all-zero
176+
#[cfg(test)]
173177
pub fn clear_account(account: &AccountInfo) -> Result<(), ProgramError> {
174178
let mut data = account
175179
.try_borrow_mut_data()

0 commit comments

Comments
 (0)