2
2
3
3
use {
4
4
crate :: {
5
- check_program_account, cmp_pubkeys ,
5
+ check_program_account,
6
6
error:: TokenError ,
7
7
extension:: {
8
8
confidential_transfer:: { self , ConfidentialTransferAccount , ConfidentialTransferMint } ,
@@ -192,7 +192,7 @@ impl Processor {
192
192
account. base . delegate = PodCOption :: none ( ) ;
193
193
account. base . delegated_amount = 0 . into ( ) ;
194
194
account. base . state = starting_state. into ( ) ;
195
- if cmp_pubkeys ( mint_info. key , & native_mint:: id ( ) ) {
195
+ if mint_info. key == & native_mint:: id ( ) {
196
196
let rent_exempt_reserve = rent. minimum_balance ( new_account_info_data_len) ;
197
197
account. base . is_native = PodCOption :: some ( rent_exempt_reserve. into ( ) ) ;
198
198
account. base . amount = new_account_info
@@ -324,7 +324,7 @@ impl Processor {
324
324
}
325
325
let ( fee, maybe_permanent_delegate, maybe_transfer_hook_program_id) =
326
326
if let Some ( ( mint_info, expected_decimals) ) = expected_mint_info {
327
- if ! cmp_pubkeys ( & source_account. base . mint , mint_info. key ) {
327
+ if & source_account. base . mint != mint_info. key {
328
328
return Err ( TokenError :: MintMismatch . into ( ) ) ;
329
329
}
330
330
@@ -380,24 +380,22 @@ impl Processor {
380
380
}
381
381
}
382
382
383
- let self_transfer = cmp_pubkeys ( source_account_info. key , destination_account_info. key ) ;
383
+ let self_transfer = source_account_info. key == destination_account_info. key ;
384
384
match ( source_account. base . delegate , maybe_permanent_delegate) {
385
- ( _, Some ( ref delegate) ) if cmp_pubkeys ( authority_info. key , delegate) => {
386
- Self :: validate_owner (
387
- program_id,
388
- delegate,
389
- authority_info,
390
- authority_info_data_len,
391
- account_info_iter. as_slice ( ) ,
392
- ) ?
393
- }
385
+ ( _, Some ( ref delegate) ) if authority_info. key == delegate => Self :: validate_owner (
386
+ program_id,
387
+ delegate,
388
+ authority_info,
389
+ authority_info_data_len,
390
+ account_info_iter. as_slice ( ) ,
391
+ ) ?,
394
392
(
395
393
PodCOption {
396
394
option : PodCOption :: < Pubkey > :: SOME ,
397
395
value : delegate,
398
396
} ,
399
397
_,
400
- ) if cmp_pubkeys ( authority_info. key , & delegate) => {
398
+ ) if authority_info. key == & delegate => {
401
399
Self :: validate_owner (
402
400
program_id,
403
401
& delegate,
@@ -465,7 +463,7 @@ impl Processor {
465
463
if destination_account. base . is_frozen ( ) {
466
464
return Err ( TokenError :: AccountFrozen . into ( ) ) ;
467
465
}
468
- if ! cmp_pubkeys ( & source_account. base . mint , & destination_account. base . mint ) {
466
+ if source_account. base . mint != destination_account. base . mint {
469
467
return Err ( TokenError :: MintMismatch . into ( ) ) ;
470
468
}
471
469
@@ -573,7 +571,7 @@ impl Processor {
573
571
}
574
572
575
573
if let Some ( ( mint_info, expected_decimals) ) = expected_mint_info {
576
- if ! cmp_pubkeys ( & source_account. base . mint , mint_info. key ) {
574
+ if & source_account. base . mint != mint_info. key {
577
575
return Err ( TokenError :: MintMismatch . into ( ) ) ;
578
576
}
579
577
@@ -624,7 +622,7 @@ impl Processor {
624
622
PodCOption {
625
623
option : PodCOption :: < Pubkey > :: SOME ,
626
624
value : delegate,
627
- } if cmp_pubkeys ( authority_info. key , delegate) => delegate,
625
+ } if authority_info. key == delegate => delegate,
628
626
_ => & source_account. base . owner ,
629
627
} ,
630
628
authority_info,
@@ -939,7 +937,7 @@ impl Processor {
939
937
if destination_account. base . is_native ( ) {
940
938
return Err ( TokenError :: NativeNotSupported . into ( ) ) ;
941
939
}
942
- if ! cmp_pubkeys ( mint_info. key , & destination_account. base . mint ) {
940
+ if mint_info. key != & destination_account. base . mint {
943
941
return Err ( TokenError :: MintMismatch . into ( ) ) ;
944
942
}
945
943
@@ -1040,22 +1038,20 @@ impl Processor {
1040
1038
. is_owned_by_system_program_or_incinerator ( )
1041
1039
{
1042
1040
match ( & source_account. base . delegate , maybe_permanent_delegate) {
1043
- ( _, Some ( ref delegate) ) if cmp_pubkeys ( authority_info. key , delegate) => {
1044
- Self :: validate_owner (
1045
- program_id,
1046
- delegate,
1047
- authority_info,
1048
- authority_info_data_len,
1049
- account_info_iter. as_slice ( ) ,
1050
- ) ?
1051
- }
1041
+ ( _, Some ( ref delegate) ) if authority_info. key == delegate => Self :: validate_owner (
1042
+ program_id,
1043
+ delegate,
1044
+ authority_info,
1045
+ authority_info_data_len,
1046
+ account_info_iter. as_slice ( ) ,
1047
+ ) ?,
1052
1048
(
1053
1049
PodCOption {
1054
1050
option : PodCOption :: < Pubkey > :: SOME ,
1055
1051
value : delegate,
1056
1052
} ,
1057
1053
_,
1058
- ) if cmp_pubkeys ( authority_info. key , delegate) => {
1054
+ ) if authority_info. key == delegate => {
1059
1055
Self :: validate_owner (
1060
1056
program_id,
1061
1057
delegate,
@@ -1120,7 +1116,7 @@ impl Processor {
1120
1116
let authority_info = next_account_info ( account_info_iter) ?;
1121
1117
let authority_info_data_len = authority_info. data_len ( ) ;
1122
1118
1123
- if cmp_pubkeys ( source_account_info. key , destination_account_info. key ) {
1119
+ if source_account_info. key == destination_account_info. key {
1124
1120
return Err ( ProgramError :: InvalidAccountData ) ;
1125
1121
}
1126
1122
@@ -1144,7 +1140,7 @@ impl Processor {
1144
1140
if let Ok ( cpi_guard) = source_account. get_extension :: < CpiGuard > ( ) {
1145
1141
if cpi_guard. lock_cpi . into ( )
1146
1142
&& in_cpi ( )
1147
- && ! cmp_pubkeys ( destination_account_info. key , & source_account. base . owner )
1143
+ && destination_account_info. key != & source_account. base . owner
1148
1144
{
1149
1145
return Err ( TokenError :: CpiGuardCloseAccountBlocked . into ( ) ) ;
1150
1146
}
@@ -1230,7 +1226,7 @@ impl Processor {
1230
1226
if source_account. base . is_native ( ) {
1231
1227
return Err ( TokenError :: NativeNotSupported . into ( ) ) ;
1232
1228
}
1233
- if ! cmp_pubkeys ( mint_info. key , & source_account. base . mint ) {
1229
+ if mint_info. key != & source_account. base . mint {
1234
1230
return Err ( TokenError :: MintMismatch . into ( ) ) ;
1235
1231
}
1236
1232
@@ -1808,20 +1804,19 @@ impl Processor {
1808
1804
owner_account_data_len : usize ,
1809
1805
signers : & [ AccountInfo ] ,
1810
1806
) -> ProgramResult {
1811
- if ! cmp_pubkeys ( expected_owner, owner_account_info. key ) {
1807
+ if expected_owner != owner_account_info. key {
1812
1808
return Err ( TokenError :: OwnerMismatch . into ( ) ) ;
1813
1809
}
1814
1810
1815
- if cmp_pubkeys ( program_id, owner_account_info. owner )
1816
- && owner_account_data_len == PodMultisig :: SIZE_OF
1811
+ if program_id == owner_account_info. owner && owner_account_data_len == PodMultisig :: SIZE_OF
1817
1812
{
1818
1813
let multisig_data = & owner_account_info. data . borrow ( ) ;
1819
1814
let multisig = pod_from_bytes :: < PodMultisig > ( multisig_data) ?;
1820
1815
let mut num_signers = 0 ;
1821
1816
let mut matched = [ false ; MAX_SIGNERS ] ;
1822
1817
for signer in signers. iter ( ) {
1823
1818
for ( position, key) in multisig. signers [ 0 ..multisig. n as usize ] . iter ( ) . enumerate ( ) {
1824
- if cmp_pubkeys ( key, signer. key ) && !matched[ position] {
1819
+ if key == signer. key && !matched[ position] {
1825
1820
if !signer. is_signer {
1826
1821
return Err ( ProgramError :: MissingRequiredSignature ) ;
1827
1822
}
0 commit comments