@@ -1383,7 +1383,7 @@ private IncrementalMerkleVoucherContainer createWitness(OutputPoint outPoint, Lo
13831383 cmCapsule .setContent (receiveDescription .getNoteCommitment ());
13841384 PedersenHash cm = cmCapsule .getInstance ();
13851385
1386- if (outPoint .getIndex () < index ) {
1386+ if (index < outPoint .getIndex ()) {
13871387 tree .append (cm );
13881388 }else if (outPoint .getIndex () == index ){
13891389 tree .append (cm );
@@ -1392,6 +1392,8 @@ private IncrementalMerkleVoucherContainer createWitness(OutputPoint outPoint, Lo
13921392 }else {
13931393 witness .append (cm );
13941394 }
1395+
1396+ index ++;
13951397 }
13961398
13971399 } else {
@@ -1633,16 +1635,17 @@ public TransactionCapsule createShieldedTransaction(PrivateParameters request)
16331635 if (!(ArrayUtils .isEmpty (ask ) || ArrayUtils .isEmpty (nsk ) || ArrayUtils .isEmpty (ovk ))) {
16341636 ExpandedSpendingKey expsk = new ExpandedSpendingKey (ask , nsk , ovk );
16351637 for (SpendNote spendNote : shieldedSpends ) {
1636- IncrementalMerkleTreeCapsule merkleTreeCapsule = dbManager .getMerkleContainer ()
1637- .getMerkleTree (spendNote .getAnchor ().toByteArray ());
1638+
16381639
16391640 GrpcAPI .Note note = spendNote .getNote ();
16401641 BaseNote .Note baseNote = new BaseNote .Note (new DiversifierT (note .getD ().toByteArray ()),
16411642 note .getPkD ().toByteArray (), note .getValue (), note .getRcm ().toByteArray ());
16421643
1644+ IncrementalMerkleVoucherContainer voucherContainer = new IncrementalMerkleVoucherCapsule (
1645+ spendNote .getVoucher ()).toMerkleVoucherContainer ();
16431646 builder .addSaplingSpend (expsk , baseNote , spendNote .getAlpha ().toByteArray (),
1644- spendNote .getAnchor ().toByteArray (),
1645- merkleTreeCapsule . toMerkleTreeContainer (). toVoucher () );
1647+ spendNote .getVoucher (). getRt ().toByteArray (),
1648+ voucherContainer );
16461649 }
16471650 }
16481651
0 commit comments