Skip to content

Commit

Permalink
log in case there is an issue with the block hash
Browse files Browse the repository at this point in the history
  • Loading branch information
lassemand committed Jun 18, 2024
1 parent f0dd162 commit 4ecb9fb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions notification-server/src/bin/service.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use clap::Parser;
use concordium_rust_sdk::v2::{Client, Endpoint};
use log::info;
use tonic::codegen::http;
use tonic::codegen::tokio_stream::StreamExt;
use tonic::transport::ClientTlsConfig;
Expand Down Expand Up @@ -48,13 +49,17 @@ async fn main() -> anyhow::Result<()> {
.await?;
let mut receiver = client.get_finalized_blocks().await?;
while let Some(v) = receiver.next().await {
println!("Blockhash: {:?}", v.clone()?.block_hash);
let transactions = client.get_block_transaction_events(v?.block_hash).await?.response;
let block_hash = v?.block_hash;
println!("Blockhash: {:?}", block_hash);
let transactions = client.get_block_transaction_events(block_hash).await?.response;
let addresses: Vec<String> = transactions
.filter_map(|t| {
match t {
Ok(t) => Some(t.affected_addresses().into_iter().map(|addr| addr.to_string()).collect::<Vec<String>>()),
Err(_) => None
Ok(t) => Some(t.affected_addresses().into_iter().map(|addr| addr.to_string()).collect::<Vec<_>>()),
Err(_) => {
info!("Not found block {}", block_hash);
None
}
}
})
.collect::<Vec<Vec<String>>>()
Expand Down

0 comments on commit 4ecb9fb

Please sign in to comment.