Skip to main content

check_token_program_match

Function check_token_program_match 

Source
pub fn check_token_program_match(
    account: &AccountView,
    token_program: &AccountView,
) -> ProgramResult
Expand description

Verify that a token account’s owning program matches the passed token program.

Critical for Token-2022 support: the token account must be owned by the same token program you’re passing to CPI transfers. Mismatches cause silent failures or exploits.

check_token_program_match(user_token, token_program)?;