-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
populate orchard note commitment trees
- Loading branch information
1 parent
a3b4de0
commit 370a4aa
Showing
1 changed file
with
11 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -456,13 +456,21 @@ impl WalletWrite for MemoryWalletDb { | |
|
||
self.blocks.insert(block.block_height, memory_block); | ||
|
||
// Add the sapling commitments to the sapling tree. | ||
let sapling_block_commitments = block.into_commitments().sapling; | ||
// 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); | ||
}); | ||
|
||
// TODO: Add orchard commitments to the orchard tree. | ||
#[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); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
oxarbitrage
Author
Contributor
|
||
}); | ||
} | ||
|
||
// TODO: Received notes need to be made available for note selection & balance calculation | ||
|
||
|
You might consider using
batch_insert
instead: https://github.com/zcash/incrementalmerkletree/blob/main/shardtree/src/batch.rs#L40 - this will both be more performant and it will avoid errors by ensuring you're inserting the note commitments at the correct spot in the tree.