comments and cleanup

This commit is contained in:
Hardhat Chad
2024-07-31 21:03:15 +00:00
parent 213a068fb0
commit 73016f3a23
6 changed files with 60 additions and 19 deletions

View File

@@ -434,3 +434,16 @@ pub fn load_program<'a, 'info>(
Ok(())
}
/// Errors if:
/// - Account is not writable.
pub fn load_any<'a, 'info>(
info: &'a AccountInfo<'info>,
is_writable: bool,
) -> Result<(), ProgramError> {
if is_writable && !info.is_writable {
return Err(ProgramError::InvalidAccountData);
}
Ok(())
}