File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 9
9
10
10
#[ inline( always) ]
11
11
pub fn process_revoke ( accounts : & [ AccountInfo ] ) -> ProgramResult {
12
- let [ source_account_info, owner_info , remaining @ ..] = accounts else {
12
+ let [ source_account_info, remaining @ ..] = accounts else {
13
13
return Err ( ProgramError :: NotEnoughAccountKeys ) ;
14
14
} ;
15
15
@@ -18,6 +18,12 @@ pub fn process_revoke(accounts: &[AccountInfo]) -> ProgramResult {
18
18
let source_account =
19
19
unsafe { load_mut :: < Account > ( source_account_info. borrow_mut_data_unchecked ( ) ) ? } ;
20
20
21
+ // Unpacking the remaining accounts to get the owner account at this point
22
+ // to maintain the same order as SPL Token.
23
+ let [ owner_info, remaining @ ..] = remaining else {
24
+ return Err ( ProgramError :: NotEnoughAccountKeys ) ;
25
+ } ;
26
+
21
27
if source_account. is_frozen ( ) ? {
22
28
return Err ( TokenError :: AccountFrozen . into ( ) ) ;
23
29
}
Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ pub fn process_burn(
21
21
// `load_mut` validates that the account is initialized.
22
22
let source_account =
23
23
unsafe { load_mut :: < Account > ( source_account_info. borrow_mut_data_unchecked ( ) ) ? } ;
24
+ // SAFETY: single mutable borrow to `mint_info` account data and
25
+ // `load_mut` validates that the mint is initialized; additionally, an
26
+ // account cannot be both a token account and a mint, so if duplicates are
27
+ // passed in, one of them will fail the `load_mut` check.
28
+ let mint = unsafe { load_mut :: < Mint > ( mint_info. borrow_mut_data_unchecked ( ) ) ? } ;
24
29
25
30
if source_account. is_frozen ( ) ? {
26
31
return Err ( TokenError :: AccountFrozen . into ( ) ) ;
@@ -36,12 +41,6 @@ pub fn process_burn(
36
41
. checked_sub ( amount)
37
42
. ok_or ( TokenError :: InsufficientFunds ) ?;
38
43
39
- // SAFETY: single mutable borrow to `mint_info` account data and
40
- // `load_mut` validates that the mint is initialized; additionally, an
41
- // account cannot be both a token account and a mint, so if duplicates are
42
- // passed in, one of them will fail the `load_mut` check.
43
- let mint = unsafe { load_mut :: < Mint > ( mint_info. borrow_mut_data_unchecked ( ) ) ? } ;
44
-
45
44
if mint_info. key ( ) != & source_account. mint {
46
45
return Err ( TokenError :: MintMismatch . into ( ) ) ;
47
46
}
You can’t perform that action at this time.
0 commit comments