diff --git a/program/src/processor/close.rs b/program/src/processor/close.rs index ce8ed3f..7cdcab1 100644 --- a/program/src/processor/close.rs +++ b/program/src/processor/close.rs @@ -18,13 +18,6 @@ pub fn close(accounts: &mut [AccountView]) -> ProgramResult { // Note that program owned and writable checks are done implicitly by writing // to the account. - // authority - // - must be a signer - - if !authority.is_signer() { - return Err(ProgramError::MissingRequiredSignature); - } - // account // - must have data // - authority must match @@ -36,6 +29,9 @@ pub fn close(accounts: &mut [AccountView]) -> ProgramResult { unsafe { account.borrow_unchecked() } }; + // authority + // - must be a signer (checked in `validate_authority`) + match AccountDiscriminator::try_from(account_data[0])? { AccountDiscriminator::Buffer => { let buffer = Buffer::from_bytes(account_data)?;