Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Nov 5, 2024
1 parent f18f5a6 commit f04eab8
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions examples/stream_blocks_single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ use futures::{Stream, StreamExt};
use log::info;
use solana_sdk::clock::Slot;
use solana_sdk::commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use std::env;
use std::pin::pin;
use solana_sdk::pubkey::Pubkey;

use csv::Writer;
use geyser_grpc_connector::grpc_subscription_autoreconnect_streams::create_geyser_reconnecting_stream;
use geyser_grpc_connector::grpcmultiplex_fastestwins::FromYellowstoneExtractor;
use geyser_grpc_connector::{GeyserFilter, GrpcConnectionTimeouts, GrpcSourceConfig, Message};
Expand All @@ -14,7 +15,6 @@ use tracing::warn;
use yellowstone_grpc_proto::geyser::subscribe_update::UpdateOneof;
use yellowstone_grpc_proto::geyser::SubscribeUpdate;
use yellowstone_grpc_proto::prost::Message as _;
use csv::Writer;

#[allow(dead_code)]
fn start_example_blockmini_consumer(
Expand Down Expand Up @@ -74,7 +74,7 @@ pub async fn main() {
tracing_subscriber::fmt::init();
// console_subscriber::init();

let COMMITMENT_LEVEL = CommitmentConfig::processed();
const COMMITMENT_LEVEL: CommitmentConfig = CommitmentConfig::processed();
let grpc_addr_green = env::var("GRPC_ADDR").expect("need grpc url for green");
let grpc_x_token_green = env::var("GRPC_X_TOKEN").ok();

Expand Down Expand Up @@ -114,10 +114,13 @@ pub async fn main() {
Some(UpdateOneof::Account(update)) => {
let account_info = update.account.unwrap();
let account_pk = Pubkey::try_from(account_info.pubkey).unwrap();
info!("got account update (green)!!! {} - {:?} - {} bytes",
update.slot, account_pk, account_info.data.len());
let bytes: [u8; 32] =
account_pk.to_bytes();
info!(
"got account update (green)!!! {} - {:?} - {} bytes",
update.slot,
account_pk,
account_info.data.len()
);
let bytes: [u8; 32] = account_pk.to_bytes();
}
_ => {}
}
Expand All @@ -138,7 +141,10 @@ pub async fn main() {
Message::GeyserSubscribeUpdate(subscriber_update) => {
let mapped = extractor.map_yellowstone_update(*subscriber_update);
if let Some((slot, block_mini)) = mapped {
info!("got update (blue)!!! block: {} - {} bytes", slot, block_mini.blocksize);
info!(
"got update (blue)!!! block: {} - {} bytes",
slot, block_mini.blocksize
);
}
}
Message::Connecting(attempt) => {
Expand All @@ -153,12 +159,3 @@ pub async fn main() {
sleep(Duration::from_secs(1800)).await;
}

fn map_block_update(update: SubscribeUpdate) -> Option<Slot> {
match update.update_oneof {
Some(UpdateOneof::Block(update_block_message)) => {
let slot = update_block_message.slot;
Some(slot)
}
_ => None,
}
}

0 comments on commit f04eab8

Please sign in to comment.