@@ -585,6 +585,7 @@ fn process_transfer(
585
585
& proof_data. transfer_with_fee_pubkeys . source_pubkey ,
586
586
& source_ciphertext_lo,
587
587
& source_ciphertext_hi,
588
+ & proof_data. new_source_ciphertext ,
588
589
new_source_decryptable_available_balance,
589
590
) ?;
590
591
@@ -643,6 +644,7 @@ fn process_transfer(
643
644
& proof_data. transfer_pubkeys . source_pubkey ,
644
645
& source_ciphertext_lo,
645
646
& source_ciphertext_hi,
647
+ & proof_data. new_source_ciphertext ,
646
648
new_source_decryptable_available_balance,
647
649
) ?;
648
650
@@ -679,6 +681,7 @@ fn process_source_for_transfer(
679
681
source_encryption_pubkey : & EncryptionPubkey ,
680
682
source_ciphertext_lo : & EncryptedBalance ,
681
683
source_ciphertext_hi : & EncryptedBalance ,
684
+ expected_new_source_available_balance : & EncryptedBalance ,
682
685
new_source_decryptable_available_balance : DecryptableBalance ,
683
686
) -> ProgramResult {
684
687
check_program_account ( token_account_info. owner ) ?;
@@ -719,6 +722,10 @@ fn process_source_for_transfer(
719
722
. ok_or ( ProgramError :: InvalidInstructionData ) ?
720
723
} ;
721
724
725
+ if new_source_available_balance != * expected_new_source_available_balance {
726
+ return Err ( TokenError :: ConfidentialTransferBalanceMismatch . into ( ) ) ;
727
+ }
728
+
722
729
confidential_transfer_account. available_balance = new_source_available_balance;
723
730
confidential_transfer_account. decryptable_available_balance =
724
731
new_source_decryptable_available_balance;
0 commit comments