@@ -190,11 +190,29 @@ public void testGenerateSpendProof() throws Exception {
190190 SpendingKey sk = SpendingKey
191191 .decode ("ff2c06269315333a9207f817d2eca0ac555ca8f90196976324c7756504e7c9ee" );
192192 ExpandedSpendingKey expsk = sk .expandedSpendingKey ();
193- PaymentAddress address = sk .defaultAddress ();
194- Note note = new Note (address , 100 );
193+
194+ DiversifierT diversifierT = new DiversifierT ();
195+ byte [] d ;
196+ while (true ) {
197+ d = org .tron .keystore .Wallet .generateRandomBytes (Constant .ZC_DIVERSIFIER_SIZE );
198+ if (Librustzcash .librustzcashCheckDiversifier (d )) {
199+ break ;
200+ }
201+ }
202+ diversifierT .setData (d );
203+
204+ FullViewingKey fullViewingKey = expsk .fullViewingKey ();
205+
206+ IncomingViewingKey incomingViewingKey = fullViewingKey .inViewingKey ();
207+
208+ Optional <PaymentAddress > op = incomingViewingKey .address (diversifierT );
209+
210+ Note note = new Note (op .get (), 100 );
195211 note .rcm = ByteArray
196212 .fromHexString ("bf4b2042e3e8c4a0b390e407a79a0b46e36eff4f7bb54b2349dbb0046ee21e02" );
213+
197214 IncrementalMerkleVoucherContainer voucher = createComplexMerkleVoucherContainer (note .cm ());
215+
198216 byte [] anchor = voucher .root ().getContent ().toByteArray ();
199217 SpendDescriptionInfo spend = new SpendDescriptionInfo (expsk , note , anchor , voucher );
200218 Pointer ctx = Librustzcash .librustzcashSaplingProvingCtxInit ();
@@ -806,11 +824,12 @@ private JSONArray readFile(String fileName) throws Exception {
806824 public void testComputeCm () throws Exception {
807825 byte [] result = new byte [32 ];
808826 if (!Librustzcash .librustzcashComputeCm (new ComputeCmParams (
809- (ByteArray .fromHexString ("fc6eb90855700861de6639" )), (
827+ (ByteArray .fromHexString ("fc6eb90855700861de6639" )),
828+ ByteArray
829+ .fromHexString ("1abfbf64bc4934aaf7f29b9fea995e5a16e654e63dbe07db0ef035499d216e19" ),
830+ 9990000000L ,
810831 ByteArray
811- .fromHexString ("1abfbf64bc4934aaf7f29b9fea995e5a16e654e63dbe07db0ef035499d216e19" )),
812- 9990000000L , (ByteArray
813- .fromHexString ("08e3a2ff1101b628147125b786c757b483f1cf7c309f8a647055bfb1ca819c02" )),
832+ .fromHexString ("08e3a2ff1101b628147125b786c757b483f1cf7c309f8a647055bfb1ca819c02" ),
814833 result )
815834 )) {
816835 System .out .println (" error" );
0 commit comments