diff --git a/block-streamer/src/bitmap.rs b/block-streamer/src/bitmap.rs index 17bc0bfdb..441de5e06 100644 --- a/block-streamer/src/bitmap.rs +++ b/block-streamer/src/bitmap.rs @@ -10,8 +10,8 @@ pub struct Base64Bitmap { pub base64: String, } -impl Base64Bitmap { - pub fn from_exact_query( +impl From<&get_bitmaps_exact::GetBitmapsExactDarunrsNearBitmapV5ActionsIndex> for Base64Bitmap { + fn from( query_item: &get_bitmaps_exact::GetBitmapsExactDarunrsNearBitmapV5ActionsIndex, ) -> Self { Self { @@ -19,8 +19,12 @@ impl Base64Bitmap { start_block_height: usize::try_from(query_item.first_block_height).unwrap(), } } +} - pub fn from_wildcard_query( +impl From<&get_bitmaps_wildcard::GetBitmapsWildcardDarunrsNearBitmapV5ActionsIndex> + for Base64Bitmap +{ + fn from( query_item: &get_bitmaps_wildcard::GetBitmapsWildcardDarunrsNearBitmapV5ActionsIndex, ) -> Self { Self { diff --git a/block-streamer/src/block_height_stream.rs b/block-streamer/src/block_height_stream.rs index 37b8bca31..fcc66bbf9 100644 --- a/block-streamer/src/block_height_stream.rs +++ b/block-streamer/src/block_height_stream.rs @@ -145,15 +145,13 @@ impl BlockHeightStreamImpl { let bitmaps_from_query: Vec = match contract_pattern_type { ContractPatternType::Exact(ref pattern) => { let query_result: Vec<_> = self.graphql_client.get_bitmaps_exact(pattern.clone(), current_date_string.clone()).await.unwrap(); - query_result.iter().map(|result_item| Base64Bitmap::from_exact_query(result_item)).collect() + query_result.iter().map(|result_item| Base64Bitmap::from(result_item)).collect() }, ContractPatternType::Wildcard(ref pattern) => { let query_result: Vec<_> = self.graphql_client.get_bitmaps_wildcard(pattern.clone(), current_date_string.clone()).await.unwrap(); - query_result.iter().map(|result_item| Base64Bitmap::from_wildcard_query(result_item)).collect() - + query_result.iter().map(|result_item| Base64Bitmap::from(result_item)).collect() }, }; - println!("date: {}, num of matched receivers: {}", ¤t_date_string, bitmaps_from_query.len()); if !bitmaps_from_query.is_empty() { let starting_block_height = bitmaps_from_query.iter().map(|item| item.start_block_height).min().unwrap(); let bitmap_for_day = self.bitmap_operator.merge_bitmaps(&bitmaps_from_query, starting_block_height).unwrap();