Skip to main content

validate_buffer_pda

Function validate_buffer_pda 

Source
pub fn validate_buffer_pda(
    buffer: &Address,
    mint: &[u8; 32],
    bump: u8,
) -> Result<(), ProgramError>
Expand description

Confirm buffer matches the derived buffer PDA for the mint bytes mint and bump, or is NATIVE_SOL_BUFFER_PDA if mint is ENCODED_NATIVE_SOL_TRANSFER.

A known mint is checked against its compile-time buffer alone, ignoring bump: nothing signs with a buffer’s seeds, so the bump only matters for re-deriving the address. That buffer is derived under crate::ID whatever program_id is, which is sound because the program only works there (see crate::pda::state::STATE_PDA).