mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-09 01:29:39 +00:00
simplify insert account logic
This commit is contained in:
parent
924b30650c
commit
eb3d3d8a8d
@ -193,16 +193,6 @@ impl WalletChainStore {
|
|||||||
.entry(account_id)
|
.entry(account_id)
|
||||||
{
|
{
|
||||||
let entry = entry.get_mut();
|
let entry = entry.get_mut();
|
||||||
let identifier = entry
|
|
||||||
.accounts
|
|
||||||
.iter()
|
|
||||||
.find_map(|(id, _)| {
|
|
||||||
(nssa::AccountId::from((&entry.key_chain.nullifier_public_key, *id))
|
|
||||||
== account_id)
|
|
||||||
.then_some(*id)
|
|
||||||
})
|
|
||||||
.unwrap_or(0);
|
|
||||||
// Update existing entry or insert new one
|
|
||||||
if let Some((_, acc)) = entry.accounts.iter_mut().find(|(id, _)| *id == identifier) {
|
if let Some((_, acc)) = entry.accounts.iter_mut().find(|(id, _)| *id == identifier) {
|
||||||
*acc = account;
|
*acc = account;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user