Skip to content

Commit

Permalink
account filter updated for calculating account_index
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder83singh committed Jul 24, 2024
1 parent 85d861a commit 883aecb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wallet/core/src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,13 @@ impl Wallet {
let account_index = if let Some(account_index) = account_index {
account_index
} else {
account_store.clone().len(Some(prv_key_data_id)).await? as u64
let accounts = account_store.clone().iter(Some(prv_key_data_id)).await?.collect::<Vec<_>>().await;

accounts
.into_iter()
.filter(|a| a.as_ref().ok().and_then(|(a, _)| (a.kind == BIP32_ACCOUNT_KIND).then_some(true)).unwrap_or(false))
.collect::<Vec<_>>()
.len() as u64
};

let xpub_key = prv_key_data.create_xpub(payment_secret, BIP32_ACCOUNT_KIND.into(), account_index).await?;
Expand Down

0 comments on commit 883aecb

Please sign in to comment.