Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
Elyniss committed Feb 9, 2024
1 parent 21da085 commit cd92c90
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/stores/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,36 +181,34 @@ impl KeysPersistentStorage for MongoPersistentStorage {
match MongoKeys::find_one_and_update(&self.db, filter, update, None).await? {
Some(_) => Ok(()),
None => {

// TODO: This is a temporary fix to handle the case where the account is not found becuase we lowercased it
return if(!account.starts_with("eip155")){
return if (!account.starts_with("eip155")) {
Err(StoreError::NotFound(
"Account".to_string(),
account.to_string(),
))
} else {

let lowercase_account = account.to_lowercase();
let filter = doc! {
"account": &lowercase_account,
};

let update = doc! {
"$pull": {
"identities" : {
"identity_key": &identity_key,
}
}
};

match MongoKeys::find_one_and_update(&self.db, filter, update, None).await? {
Some(_) => Ok(()),
None => Err(StoreError::NotFound(
"Account".to_string(),
lowercase_account.to_string(),
)),
}
}
};
}
}
}
Expand Down

0 comments on commit cd92c90

Please sign in to comment.