Skip to main content

assert_not_initialized

Function assert_not_initialized 

Source
pub fn assert_not_initialized(account: &AccountView) -> ProgramResult
Expand description

Verify an account has never been initialized by checking that its lamports are zero.

Different from check_uninitialized which checks for empty data. This checks lamports == 0, meaning the account doesn’t exist on-chain yet. Useful for create-if-not-exists patterns where you want to confirm the account hasn’t been funded.

assert_not_initialized(new_vault)?;