Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: synchronize is_collection_verified && specification_version #35

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions digital_asset_types/src/dao/scopes/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,7 @@ pub async fn get_grouping(
.ok_or(DbErr::Custom("cannot get rows count".to_string()))?],
))
.await?
.iter()
.map(|res| res.try_get::<i64>("", "count").unwrap_or_default())
.collect::<Vec<_>>()
.last()
.copied()
.unwrap_or_default();

Ok(GroupingSize { size: size as u64 })
Expand Down
4 changes: 4 additions & 0 deletions rocks-db/src/batch_client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::{HashMap, HashSet};

use async_trait::async_trait;
use entities::enums::SpecificationVersions;
use solana_sdk::pubkey::Pubkey;

use crate::asset::{AssetsUpdateIdx, SlotAssetIdx};
Expand Down Expand Up @@ -92,6 +93,7 @@ impl AssetIndexReader for Storage {
for static_info in asset_static_details.iter().flatten() {
let asset_index = AssetIndex {
pubkey: static_info.pubkey,
specification_version: SpecificationVersions::V1,
specification_asset_class: static_info.specification_asset_class,
royalty_target_type: static_info.royalty_target_type,
slot_created: static_info.created_at,
Expand Down Expand Up @@ -174,13 +176,15 @@ impl AssetIndexReader for Storage {
for data in asset_collection_details.iter().flatten() {
if let Some(existed_index) = asset_indexes.get_mut(&data.pubkey) {
existed_index.collection = Some(data.collection);
existed_index.is_collection_verified = Some(data.is_collection_verified);
if data.slot_updated as i64 > existed_index.slot_updated {
existed_index.slot_updated = data.slot_updated as i64;
}
} else {
let asset_index = AssetIndex {
pubkey: data.pubkey,
collection: Some(data.collection),
is_collection_verified: Some(data.is_collection_verified),
slot_updated: data.slot_updated as i64,
..Default::default()
};
Expand Down
Loading