Skip to content

Commit

Permalink
use batch_insert
Browse files Browse the repository at this point in the history
  • Loading branch information
oxarbitrage committed Apr 2, 2024
1 parent 370a4aa commit b1a0fcc
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions zcash_client_backend/src/data_api/mem_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,18 +458,16 @@ impl WalletWrite for MemoryWalletDb {

// Add the Sapling commitments to the sapling tree.
let block_commitments = block.into_commitments();
let sapling_block_commitments = block_commitments.sapling;
sapling_block_commitments.iter().map(|(node, height)| {
self.sapling_tree.append(*node, *height);
});
if let Ok(Some(pos)) = self.sapling_tree.max_leaf_position(0) {
self.sapling_tree
.batch_insert(pos, block_commitments.sapling.into_iter());
}

#[cfg(feature = "orchard")]
{
// Add the Orchard commitments to the sapling tree.
let orchard_block_commitments = block_commitments.orchard;
orchard_block_commitments.iter().map(|(node, height)| {
self.orchard_tree.append(*node, *height);
});
// Add the Orchard commitments to the orchard tree.
if let Ok(Some(pos)) = self.orchard_tree.max_leaf_position(0) {

This comment has been minimized.

Copy link
@nuttycom

nuttycom Apr 3, 2024

Contributor

Instead of this, obtain the correct starting note commitment tree position from the from_state argument.

This comment has been minimized.

Copy link
@oxarbitrage

oxarbitrage Apr 3, 2024

Author Contributor

Thanks, changed this at 588156f

self.orchard_tree
.batch_insert(pos, block_commitments.orchard.into_iter());
}

// TODO: Received notes need to be made available for note selection & balance calculation
Expand Down

0 comments on commit b1a0fcc

Please sign in to comment.