From 5ef5f043f542c6400d7e706784ab9cf96893b658 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Wed, 20 Mar 2024 11:49:48 -0600 Subject: [PATCH] zcash_client_backend: Add `MemoryWalletDb::new()` --- .../src/data_api/mem_wallet.rs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/zcash_client_backend/src/data_api/mem_wallet.rs b/zcash_client_backend/src/data_api/mem_wallet.rs index 345237484..52a3e4613 100644 --- a/zcash_client_backend/src/data_api/mem_wallet.rs +++ b/zcash_client_backend/src/data_api/mem_wallet.rs @@ -6,7 +6,7 @@ use std::{ cmp::Ordering, collections::{BTreeMap, HashMap, HashSet}, convert::Infallible, - num::NonZeroU32, + num::NonZeroU32, hash::Hash, }; use zcash_keys::keys::{AddressGenerationError, DerivationError}; use zip32::{fingerprint::SeedFingerprint, DiversifierIndex}; @@ -99,6 +99,24 @@ pub struct MemoryWalletDb { >, } +impl MemoryWalletDb { + pub fn new( + network: Network, + max_checkpoints: usize + ) -> Self { + Self { + network, + accounts: BTreeMap::new(), + blocks: BTreeMap::new(), + tx_idx: HashMap::new(), + sapling_spends: BTreeMap::new(), + orchard_spends: BTreeMap::new(), + sapling_tree: ShardTree::new(MemoryShardStore::empty(), max_checkpoints), + orchard_tree: ShardTree::new(MemoryShardStore::empty(), max_checkpoints), + } + } +} + #[derive(Debug)] pub enum Error { AccountUnknown(u32),