This repository was archived by the owner on Mar 11, 2025. It is now read-only.
File tree 3 files changed +19
-15
lines changed
3 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -3876,19 +3876,23 @@ where
3876
3876
& self ,
3877
3877
) -> TokenResult < u64 > {
3878
3878
let account = self . get_account ( self . pubkey ) . await ?;
3879
+ let account_data_len = account. data . len ( ) ;
3879
3880
let account_lamports = account. lamports ;
3880
- let new_account_len = account
3881
- . data
3882
- . len ( )
3883
- . saturating_add ( size_of :: < ExtensionType > ( ) )
3884
- . saturating_add ( size_of :: < Length > ( ) )
3885
- . saturating_add ( size_of :: < V > ( ) ) ;
3886
- let new_rent_exempt_minimum = self
3887
- . client
3888
- . get_minimum_balance_for_rent_exemption ( new_account_len)
3889
- . await
3890
- . map_err ( TokenError :: Client ) ?;
3891
- Ok ( new_rent_exempt_minimum. saturating_sub ( account_lamports) )
3881
+ let mint_state = self . unpack_mint_info ( account) ?;
3882
+ if mint_state. get_extension :: < V > ( ) . is_ok ( ) {
3883
+ Ok ( 0 )
3884
+ } else {
3885
+ let new_account_len = account_data_len
3886
+ . saturating_add ( size_of :: < ExtensionType > ( ) )
3887
+ . saturating_add ( size_of :: < Length > ( ) )
3888
+ . saturating_add ( size_of :: < V > ( ) ) ;
3889
+ let new_rent_exempt_minimum = self
3890
+ . client
3891
+ . get_minimum_balance_for_rent_exemption ( new_account_len)
3892
+ . await
3893
+ . map_err ( TokenError :: Client ) ?;
3894
+ Ok ( new_rent_exempt_minimum. saturating_sub ( account_lamports) )
3895
+ }
3892
3896
}
3893
3897
3894
3898
/// Initialize token-group on a mint
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ impl TestContext {
146
146
let token_unchecked = Token :: new_native ( Arc :: clone ( & client) , & id ( ) , Arc :: new ( payer) ) ;
147
147
self . token_context = Some ( TokenContext {
148
148
decimals : native_mint:: DECIMALS ,
149
- mint_authority : Keypair :: new ( ) , /*bogus*/
149
+ mint_authority : Keypair :: new ( ) , /* bogus */
150
150
token,
151
151
token_unchecked,
152
152
alice : Keypair :: new ( ) ,
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ async fn success_initialize() {
131
131
& payer_pubkey,
132
132
& token_context. mint_authority . pubkey ( ) ,
133
133
& update_authority,
134
- max_size ,
134
+ 12 , // Change so we get a different transaction
135
135
& [ & token_context. mint_authority ] ,
136
136
)
137
137
. await
@@ -140,7 +140,7 @@ async fn success_initialize() {
140
140
error,
141
141
TokenClientError :: Client ( Box :: new( TransportError :: TransactionError (
142
142
TransactionError :: InstructionError (
143
- 1 ,
143
+ 0 , // No additional rent
144
144
InstructionError :: Custom ( TokenError :: ExtensionAlreadyInitialized as u32 )
145
145
)
146
146
) ) )
You can’t perform that action at this time.
0 commit comments