Skip to content

Commit 588156f

Browse files
committed
fix note commitment tree starting position
1 parent 2f28306 commit 588156f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

zcash_client_backend/src/data_api/mem_wallet.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,16 +497,16 @@ impl WalletWrite for MemoryWalletDb {
497497

498498
// Add the Sapling commitments to the sapling tree.
499499
let block_commitments = block.into_commitments();
500-
if let Ok(Some(pos)) = self.sapling_tree.max_leaf_position(0) {
500+
if let Some(value) = from_state.final_sapling_tree().value() {
501501
self.sapling_tree
502-
.batch_insert(pos, block_commitments.sapling.into_iter());
502+
.batch_insert(value.position(), block_commitments.sapling.into_iter());
503503
}
504504

505505
#[cfg(feature = "orchard")]
506506
// Add the Orchard commitments to the orchard tree.
507-
if let Ok(Some(pos)) = self.orchard_tree.max_leaf_position(0) {
507+
if let Some(value) = from_state.final_orchard_tree().value() {
508508
self.orchard_tree
509-
.batch_insert(pos, block_commitments.orchard.into_iter());
509+
.batch_insert(value.position(), block_commitments.orchard.into_iter());
510510
}
511511
}
512512

0 commit comments

Comments
 (0)