Skip to content

Commit 08c750f

Browse files
committed
solana: Simplify constraint using map_or
1 parent 7932667 commit 08c750f

File tree

1 file changed

+4
-4
lines changed
  • solana/programs/example-native-token-transfers/src/instructions

1 file changed

+4
-4
lines changed

solana/programs/example-native-token-transfers/src/instructions/admin.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,10 @@ pub fn set_token_authority_one_step_unchecked(
344344
pub struct SetTokenAuthorityChecked<'info> {
345345
#[account(
346346
constraint =
347-
(common.multisig_token_authority.is_some() &&
348-
common.multisig_token_authority.clone().unwrap().key() == common.mint.mint_authority.unwrap()) ||
349-
(common.multisig_token_authority.is_none() &&
350-
common.token_authority.key() == common.mint.mint_authority.unwrap())
347+
common.mint.mint_authority.unwrap() == common.multisig_token_authority.as_ref().map_or(
348+
common.token_authority.key(),
349+
|multisig_token_authority| multisig_token_authority.key()
350+
)
351351
@ NTTError::InvalidMintAuthority
352352
)]
353353
pub common: SetTokenAuthority<'info>,

0 commit comments

Comments
 (0)