@@ -16,6 +16,7 @@ use light_compressed_token_sdk::{
1616 ValidityProof ,
1717} ;
1818use light_ctoken_types:: instructions:: transfer2:: { Compression , MultiTokenTransferOutputData } ;
19+ use light_program_test:: utils:: assert:: assert_rpc_error;
1920pub use light_program_test:: { LightProgramTest , ProgramTestConfig } ;
2021pub use light_test_utils:: {
2122 airdrop_lamports,
@@ -205,7 +206,7 @@ async fn test_spl_to_ctoken_transfer() {
205206}
206207
207208#[ tokio:: test]
208- async fn test_ctoken_to_spl_with_compress_and_close ( ) {
209+ async fn test_failing_ctoken_to_spl_with_compress_and_close ( ) {
209210 let mut rpc = LightProgramTest :: new ( ProgramTestConfig :: new ( true , None ) )
210211 . await
211212 . unwrap ( ) ;
@@ -312,54 +313,10 @@ async fn test_ctoken_to_spl_with_compress_and_close() {
312313 . unwrap ( ) ;
313314
314315 // Execute transaction
315- rpc. create_and_send_transaction ( & [ transfer_ix] , & payer. pubkey ( ) , & [ & payer, & recipient] )
316- . await
317- . unwrap ( ) ;
318-
319- // Verify final balances
320- {
321- // Verify SPL token balance is restored
322- let spl_account_data = rpc
323- . get_account ( spl_token_account_keypair. pubkey ( ) )
324- . await
325- . unwrap ( )
326- . unwrap ( ) ;
327- let spl_account = spl_pod:: bytemuck:: pod_from_bytes :: < PodAccount > ( & spl_account_data. data )
328- . map_err ( |e| {
329- RpcError :: AssertRpcError ( format ! ( "Failed to parse SPL token account: {}" , e) )
330- } )
331- . unwrap ( ) ;
332- let restored_spl_balance: u64 = spl_account. amount . into ( ) ;
333- assert_eq ! (
334- restored_spl_balance, amount,
335- "SPL token balance should be restored to original amount"
336- ) ;
337- }
338-
339- {
340- // Verify CToken account is CLOSED (not just balance = 0)
341- let ctoken_account_result = rpc. get_account ( associated_token_account) . await . unwrap ( ) ;
342- match ctoken_account_result {
343- None => {
344- println ! ( "✓ CToken account successfully closed (account does not exist)" ) ;
345- }
346- Some ( account_data) => {
347- assert_eq ! (
348- account_data. data. len( ) ,
349- 0 ,
350- "CToken account data should be empty after CompressAndClose"
351- ) ;
352- assert_eq ! (
353- account_data. lamports, 0 ,
354- "CToken account lamports should be 0 after CompressAndClose"
355- ) ;
356- println ! ( "✓ CToken account successfully closed (zeroed out)" ) ;
357- }
358- }
359- }
360-
361- println ! ( "✓ Successfully completed CToken -> SPL transfer with CompressAndClose" ) ;
362- println ! ( " This validates owner can use CompressAndClose without explicit compressed_token_account validation" ) ;
316+ let result = rpc
317+ . create_and_send_transaction ( & [ transfer_ix] , & payer. pubkey ( ) , & [ & payer, & recipient] )
318+ . await ;
319+ assert_rpc_error ( result, 0 , 3 ) . unwrap ( ) ;
363320}
364321
365322pub struct CtokenToSplTransferAndClose {
0 commit comments