This commit is contained in:
GroovieGermanikus 2024-04-18 17:39:59 +02:00
parent 458f82725a
commit 0a5aaf4846
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
1 changed files with 7 additions and 5 deletions

View File

@ -74,6 +74,7 @@ pub async fn main() {
tracing_subscriber::fmt::init();
// console_subscriber::init();
let COMMITMENT_LEVEL = 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();
@ -96,12 +97,12 @@ pub async fn main() {
let green_stream = create_geyser_reconnecting_stream(
config.clone(),
GeyserFilter(CommitmentConfig::processed()).accounts(),
GeyserFilter(COMMITMENT_LEVEL).accounts(),
);
let blue_stream = create_geyser_reconnecting_stream(
config.clone(),
GeyserFilter(CommitmentConfig::processed()).blocks_and_txs(),
GeyserFilter(COMMITMENT_LEVEL).blocks_and_txs(),
);
tokio::spawn(async move {
@ -131,12 +132,13 @@ pub async fn main() {
tokio::spawn(async move {
let mut blue_stream = pin!(blue_stream);
let extractor = BlockMiniExtractor(COMMITMENT_LEVEL);
while let Some(message) = blue_stream.next().await {
match message {
Message::GeyserSubscribeUpdate(subscriber_update) => {
let mapped = map_block_update(*subscriber_update);
if let Some(slot) = mapped {
info!("got update (blue)!!! slot: {}", slot);
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);
}
}
Message::Connecting(attempt) => {