fix: comments fix 1

This commit is contained in:
Pravdyvy 2025-11-26 07:32:35 +02:00
parent 0d11c3688e
commit fc531021fb
4 changed files with 17 additions and 16 deletions

View File

@ -36,7 +36,7 @@ impl WalletChainStore {
_ => false,
})
.cloned()
.unwrap();
.expect("Malformed persistent account data, must have public root");
let private_root = persistent_accounts
.iter()
@ -45,7 +45,7 @@ impl WalletChainStore {
_ => false,
})
.cloned()
.unwrap();
.expect("Malformed persistent account data, must have private root");
let mut public_tree = KeyTreePublic::new_from_root(match public_root {
PersistentAccountData::Public(data) => data.data,

View File

@ -92,11 +92,13 @@ pub enum NewSubcommand {
///Register new public account
Public {
#[arg(long)]
/// Chain index of a parent node
cci: ChainIndex,
},
///Register new private account
Private {
#[arg(long)]
/// Chain index of a parent node
cci: ChainIndex,
},
}
@ -274,13 +276,19 @@ impl WalletSubcommand for AccountSubcommand {
.await?
.last_block;
if !wallet_core
if wallet_core
.storage
.user_data
.private_key_tree
.addr_map
.is_empty()
{
wallet_core.last_synced_block = curr_last_block;
let path = wallet_core.store_persistent_data().await?;
println!("Stored persistent data at {path:#?}");
} else {
parse_block_range(
last_synced_block + 1,
curr_last_block,
@ -288,12 +296,6 @@ impl WalletSubcommand for AccountSubcommand {
wallet_core,
)
.await?;
} else {
wallet_core.last_synced_block = curr_last_block;
let path = wallet_core.store_persistent_data().await?;
println!("Stored persistent data at {path:#?}");
}
Ok(SubcommandReturnValue::SyncedToBlock(curr_last_block))

View File

@ -91,7 +91,7 @@ pub async fn fetch_config() -> Result<WalletConfig> {
/// Fetch data stored at home
///
/// If file not present, it is considered as empty list of persistent accounts
/// File must be created through setup beforehand.
pub async fn fetch_persistent_storage() -> Result<PersistentStorage> {
let home = get_home()?;
let accs_path = home.join("storage.json");

View File

@ -249,12 +249,14 @@ pub enum Command {
Config(ConfigSubcommand),
}
/// Represents CLI command for a wallet with setup included
/// Represents overarching CLI command for a wallet with setup included
#[derive(Debug, Subcommand, Clone)]
#[clap(about)]
pub enum OverCommand {
/// Represents CLI command for a wallet
#[command(subcommand)]
Command(Command),
/// Setup of a storage. Initializes rots for public and private trees from `password`.
Setup {
#[arg(short, long)]
password: String,
@ -369,11 +371,8 @@ pub async fn parse_block_range(
if let NSSATransaction::PrivacyPreserving(tx) = nssa_tx {
let mut affected_accounts = vec![];
for (acc_addr, (key_chain, _)) in wallet_core
.storage
.user_data
.default_user_private_accounts
.iter()
for (acc_addr, (key_chain, _)) in
&wallet_core.storage.user_data.default_user_private_accounts
{
let view_tag = EncryptedAccountData::compute_view_tag(
key_chain.nullifer_public_key.clone(),