Skip to content

Commit

Permalink
fix: use Account instead of AccountDetails in store
Browse files Browse the repository at this point in the history
  • Loading branch information
polydez committed Apr 4, 2024
1 parent 30441e0 commit 76504e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion store/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::fs::{self, create_dir_all};

use deadpool_sqlite::{Config as SqliteConfig, Hook, HookError, Pool, Runtime};
use miden_objects::{
accounts::Account,
crypto::{hash::rpo::RpoDigest, merkle::MerklePath, utils::Deserializable},
notes::Nullifier,
transaction::AccountDetails,
Expand Down Expand Up @@ -36,7 +37,7 @@ pub struct AccountInfo {
pub account_id: AccountId,
pub account_hash: RpoDigest,
pub block_num: BlockNumber,
pub details: Option<AccountDetails>,
pub details: Option<Account>,
}

#[derive(Debug, PartialEq)]
Expand Down
5 changes: 3 additions & 2 deletions store/src/db/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use std::rc::Rc;

use miden_objects::{
accounts::Account,
crypto::{hash::rpo::RpoDigest, merkle::MerklePath},
notes::Nullifier,
transaction::AccountDetails,
Expand Down Expand Up @@ -46,7 +47,7 @@ pub fn select_accounts(conn: &mut Connection) -> Result<Vec<AccountInfo>> {
let account_hash_data = row.get_ref(1)?.as_blob()?;
let account_hash = RpoDigest::read_from_bytes(account_hash_data)?;
let block_num = row.get(2)?;
let details = <Option<AccountDetails>>::read_from_bytes(row.get_ref(3)?.as_bytes()?)?;
let details = <Option<Account>>::read_from_bytes(row.get_ref(3)?.as_bytes()?)?;

accounts.push(AccountInfo {
account_id,
Expand Down Expand Up @@ -120,7 +121,7 @@ pub fn select_accounts_by_block_range(
let account_hash_data = row.get_ref(1)?.as_blob()?;
let account_hash = RpoDigest::read_from_bytes(account_hash_data)?;
let block_num = row.get(2)?;
let details = <Option<AccountDetails>>::read_from_bytes(row.get_ref(3)?.as_bytes()?)?;
let details = <Option<Account>>::read_from_bytes(row.get_ref(3)?.as_bytes()?)?;

result.push(AccountInfo {
account_id,
Expand Down

0 comments on commit 76504e0

Please sign in to comment.