From 9c0c6b079a6d4554c241a0479ad440b2a0d9f235 Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Fri, 22 Mar 2024 11:15:13 -0300 Subject: [PATCH] append sapling noie commitments to database --- zcash_client_backend/src/data_api/mem_wallet.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zcash_client_backend/src/data_api/mem_wallet.rs b/zcash_client_backend/src/data_api/mem_wallet.rs index e66229078..72b9d2860 100644 --- a/zcash_client_backend/src/data_api/mem_wallet.rs +++ b/zcash_client_backend/src/data_api/mem_wallet.rs @@ -419,6 +419,8 @@ impl WalletWrite for MemoryWalletDb { }) .count(); + // TODO: Add orchard nullifiers to the orchard spends. + // Is `self.tx_idx` field filled with all the transaction ids from the scanned blocks ? self.tx_idx.insert(txid, block.block_height); transactions.insert(txid, transaction); @@ -434,6 +436,18 @@ 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; + sapling_block_commitments.iter().map(|(node, height)| { + self.sapling_tree.append(*node, *height); + }); + + // TODO: Add orchard commitments to the orchard tree. + + // TODO: Received notes need to be made available for note selection & balance calculation + + // TODO: Spent notes need to be made unavailable for note selection & balance calculation } Ok(())