Skip to content

Commit

Permalink
remove redundant check (#1139)
Browse files Browse the repository at this point in the history
* remove redundant check

* add comment
  • Loading branch information
samuelvanderwaal authored Jul 7, 2023
1 parent d6f96f6 commit 6cafec6
Showing 1 changed file with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use solana_program::{
};

use crate::{
assertions::{assert_owned_by, collection::assert_has_collection_authority},
assertions::assert_owned_by,
error::MetadataError,
instruction::SetCollectionSizeArgs,
state::{CollectionDetails, Metadata, TokenMetadataAccount},
Expand All @@ -29,12 +29,6 @@ pub fn bubblegum_set_collection_size(
let collection_mint_account_info = next_account_info(account_info_iter)?;
let bubblegum_signer_info = next_account_info(account_info_iter)?;

let delegated_collection_auth_opt = if accounts.len() == 5 {
Some(next_account_info(account_info_iter)?)
} else {
None
};

if !BUBBLEGUM_ACTIVATED {
return Err(MetadataError::InvalidOperation.into());
}
Expand All @@ -54,17 +48,11 @@ pub fn bubblegum_set_collection_size(
let mut metadata = Metadata::from_account_info(parent_nft_metadata_account_info)?;

// Check that the update authority or delegate is a signer.
// Collection authority is validated in the bubblegum program in the assert_has_collection_authority call.
if !collection_update_authority_account_info.is_signer {
return Err(MetadataError::UpdateAuthorityIsNotSigner.into());
}

assert_has_collection_authority(
collection_update_authority_account_info,
&metadata,
collection_mint_account_info.key,
delegated_collection_auth_opt,
)?;

// Ensure new size is + or - 1 of the current size.
let current_size = if let Some(details) = metadata.collection_details {
match details {
Expand Down

0 comments on commit 6cafec6

Please sign in to comment.