account-compression 2.0.0

Solana account compression program
Documentation
1
2
3
4
5
6
7
8
use anchor_lang::{error::ErrorCode, Owner, Result, ZeroCopy};

pub fn check_discriminator<T: ZeroCopy + Owner + std::fmt::Debug>(data: &[u8]) -> Result<()> {
    if &data[..8] != T::DISCRIMINATOR {
        return Err(ErrorCode::AccountDiscriminatorMismatch.into());
    }
    Ok(())
}