zcash_client_backend: Add `MemoryWalletDb::new()`

This commit is contained in:
Kris Nuttycombe 2024-03-20 11:49:48 -06:00
parent 99260577a4
commit 5ef5f043f5
1 changed files with 19 additions and 1 deletions

View File

@ -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),