@@ -349,31 +349,30 @@ public void testDecryptReceiveWithIvk() throws ZksnarkException {
349349 receiveDescription .getNoteCommitment ().toByteArray () //cm
350350 );
351351
352- if (ret1 .isPresent ()) {
353- Note noteText = ret1 .get ();
354-
355- byte [] pk_d = new byte [32 ];
356- if (!JLibrustzcash .librustzcashIvkToPkd (
357- new IvkToPkdParams (incomingViewingKey .getValue (), noteText .d .getData (), pk_d ))) {
358- JLibrustzcash .librustzcashSaplingProvingCtxFree (ctx );
359- return ;
360- }
361-
362- Assert .assertArrayEquals (paymentAddress .getPkD (), pk_d );
363- Assert .assertEquals (noteText .value , 4000 );
364- Assert .assertArrayEquals (noteText .memo , memo );
352+ Assert .assertTrue (ret1 .isPresent ());
353+
354+ Note noteText = ret1 .get ();
355+ byte [] pkD = new byte [32 ];
356+ if (!JLibrustzcash .librustzcashIvkToPkd (
357+ new IvkToPkdParams (incomingViewingKey .getValue (), noteText .d .getData (), pkD ))) {
358+ JLibrustzcash .librustzcashSaplingProvingCtxFree (ctx );
359+ return ;
360+ }
365361
366- String paymentAddressStr = KeyIo .encodePaymentAddress (
367- new PaymentAddress (noteText .d , pk_d ));
362+ Assert .assertArrayEquals (paymentAddress .getPkD (), pkD );
363+ Assert .assertEquals (noteText .value , 4000 );
364+ Assert .assertArrayEquals (noteText .memo , memo );
368365
369- GrpcAPI .Note decrypt_note = GrpcAPI .Note .newBuilder ()
370- .setPaymentAddress (paymentAddressStr )
371- .setValue (noteText .value )
372- .setRcm (ByteString .copyFrom (noteText .rcm ))
373- .setMemo (ByteString .copyFrom (noteText .memo ))
374- .build ();
375- }
366+ String paymentAddressStr = KeyIo .encodePaymentAddress (
367+ new PaymentAddress (noteText .d , pkD ));
376368
369+ GrpcAPI .Note grpcAPINote = GrpcAPI .Note .newBuilder ()
370+ .setPaymentAddress (paymentAddressStr )
371+ .setValue (noteText .value )
372+ .setRcm (ByteString .copyFrom (noteText .rcm ))
373+ .setMemo (ByteString .copyFrom (noteText .memo ))
374+ .build ();
375+
377376 JLibrustzcash .librustzcashSaplingProvingCtxFree (ctx );
378377 }
379378
@@ -415,15 +414,15 @@ public void testDecryptReceiveWithOvk() throws Exception {
415414 byte [] memo = org .tron .keystore .Wallet .generateRandomBytes (512 );
416415 note .memo = memo ;
417416
418- byte [] cmu_opt = note .cm ();
419- Assert .assertNotNull (cmu_opt );
417+ byte [] cmuOpt = note .cm ();
418+ Assert .assertNotNull (cmuOpt );
420419
421420 NotePlaintextEncryptionResult enc = note .encrypt (pkd ).get ();
422421 NoteEncryption encryptor = enc .noteEncryption ;
423- OutgoingPlaintext out_pt = new OutgoingPlaintext (note .pkD , encryptor .esk );
422+ OutgoingPlaintext outgoingPlaintext = new OutgoingPlaintext (note .pkD , encryptor .esk );
424423
425424 // encrypt with ovk
426- Encryption .OutCiphertext outCiphertext = out_pt .encrypt (
425+ Encryption .OutCiphertext outCiphertext = outgoingPlaintext .encrypt (
427426 fullViewingKey .getOvk (),
428427 receiveDescription .getValueCommitment ().toByteArray (),
429428 receiveDescription .getNoteCommitment ().toByteArray (),
@@ -438,19 +437,19 @@ public void testDecryptReceiveWithOvk() throws Exception {
438437 );
439438
440439 if (ret2 .isPresent ()) {
441- OutgoingPlaintext decrypted_out_ct_unwrapped = ret2 .get ();
442- Assert .assertArrayEquals (decrypted_out_ct_unwrapped .pk_d , out_pt .pk_d );
443- Assert .assertArrayEquals (decrypted_out_ct_unwrapped .esk , out_pt .esk );
440+ OutgoingPlaintext decryptedOutgoingPlaintext = ret2 .get ();
441+ Assert .assertArrayEquals (decryptedOutgoingPlaintext .pk_d , outgoingPlaintext .pk_d );
442+ Assert .assertArrayEquals (decryptedOutgoingPlaintext .esk , outgoingPlaintext .esk );
444443
445444 //decrypt c_enc with pkd、esk
446445 Encryption .EncCiphertext ciphertext = new Encryption .EncCiphertext ();
447446 ciphertext .data = enc .encCiphertext ;
448447 Optional <Note > foo = Note
449448 .decrypt (ciphertext ,
450- encryptor .epk ,
451- decrypted_out_ct_unwrapped .esk ,
452- decrypted_out_ct_unwrapped .pk_d ,
453- cmu_opt );
449+ encryptor .epk ,
450+ decryptedOutgoingPlaintext .esk ,
451+ decryptedOutgoingPlaintext .pk_d ,
452+ cmuOpt );
454453
455454 if (foo .isPresent ()) {
456455 Note bar = foo .get ();
@@ -529,13 +528,13 @@ public void pushShieldedTransactionAndDecryptWithIvk()
529528
530529 if (ret1 .isPresent ()) {
531530 Note noteText = ret1 .get ();
532- byte [] pk_d = new byte [32 ];
531+ byte [] pkD = new byte [32 ];
533532 if (!JLibrustzcash .librustzcashIvkToPkd (
534- new IvkToPkdParams (incomingViewingKey .getValue (), noteText .d .getData (), pk_d ))) {
533+ new IvkToPkdParams (incomingViewingKey .getValue (), noteText .d .getData (), pkD ))) {
535534 JLibrustzcash .librustzcashSaplingProvingCtxFree (ctx );
536535 return ;
537536 }
538- Assert .assertArrayEquals (paymentAddress .getPkD (), pk_d );
537+ Assert .assertArrayEquals (paymentAddress .getPkD (), pkD );
539538 Assert .assertEquals (1000 * 1000000 - wallet .getShieldedTransactionFee (), noteText .value );
540539 Assert .assertArrayEquals (memo , noteText .memo );
541540 } else {
@@ -603,27 +602,27 @@ public void pushShieldedTransactionAndDecryptWithOvk()
603602 .unpack (Contract .ShieldedTransferContract .class );
604603 ReceiveDescription receiveDescription = stContract .getReceiveDescription (0 );
605604
606- Encryption .OutCiphertext c_out = new Encryption .OutCiphertext ();
607- c_out .data = receiveDescription .getCOut ().toByteArray ();
605+ Encryption .OutCiphertext cOut = new Encryption .OutCiphertext ();
606+ cOut .data = receiveDescription .getCOut ().toByteArray ();
608607 Optional <OutgoingPlaintext > notePlaintext = OutgoingPlaintext .decrypt (
609- c_out ,//ciphertext
608+ cOut ,//ciphertext
610609 fullViewingKey .getOvk (),
611610 receiveDescription .getValueCommitment ().toByteArray (), //cv
612611 receiveDescription .getNoteCommitment ().toByteArray (), //cmu
613612 receiveDescription .getEpk ().toByteArray () //epk
614613 );
615614
616615 if (notePlaintext .isPresent ()) {
617- OutgoingPlaintext decrypted_out_ct_unwrapped = notePlaintext .get ();
616+ OutgoingPlaintext decryptedOutgoingPlaintext = notePlaintext .get ();
618617 //decode c_enc with pkd、esk
619618 Encryption .EncCiphertext ciphertext = new Encryption .EncCiphertext ();
620619 ciphertext .data = receiveDescription .getCEnc ().toByteArray ();
621620 Optional <Note > foo = Note
622621 .decrypt (ciphertext ,
623- receiveDescription .getEpk ().toByteArray (),
624- decrypted_out_ct_unwrapped .esk ,
625- decrypted_out_ct_unwrapped .pk_d ,
626- receiveDescription .getNoteCommitment ().toByteArray ());
622+ receiveDescription .getEpk ().toByteArray (),
623+ decryptedOutgoingPlaintext .esk ,
624+ decryptedOutgoingPlaintext .pk_d ,
625+ receiveDescription .getNoteCommitment ().toByteArray ());
627626
628627 if (foo .isPresent ()) {
629628 Note bar = foo .get ();
0 commit comments