From c92ce5074db8b87310932a9d1e5e3b8fe8aa4be2 Mon Sep 17 00:00:00 2001 From: Aniket Prajapati <42654595+aniketfuryrocks@users.noreply.github.com> Date: Mon, 6 Feb 2023 20:45:26 +0530 Subject: [PATCH] add MAX_RECENT_BLOCKHASSHES and some logs (#49) --- src/block_store.rs | 2 ++ src/bridge.rs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/block_store.rs b/src/block_store.rs index 800d2cdc..3bc29547 100644 --- a/src/block_store.rs +++ b/src/block_store.rs @@ -2,6 +2,7 @@ use std::sync::Arc; use dashmap::DashMap; +use log::info; use solana_rpc_client::nonblocking::rpc_client::RpcClient; use solana_sdk::commitment_config::CommitmentConfig; use tokio::sync::RwLock; @@ -92,6 +93,7 @@ impl BlockStore { block_info: BlockInformation, commitment_config: CommitmentConfig, ) { + info!("ab {blockhash} {block_info:?}"); // Write to block store first in order to prevent // any race condition i.e prevent some one to // ask the map what it doesn't have rn diff --git a/src/bridge.rs b/src/bridge.rs index 6c39f3d2..dd6b20a2 100644 --- a/src/bridge.rs +++ b/src/bridge.rs @@ -34,6 +34,7 @@ use tokio::{ sync::mpsc::{self, UnboundedSender}, task::JoinHandle, }; +use solana_sdk::clock::MAX_RECENT_BLOCKHASHES; lazy_static::lazy_static! { static ref RPC_SEND_TX: Counter = @@ -247,6 +248,8 @@ impl LiteRpcServer for LiteBridge { .get_latest_block_info(commitment_config) .await; + info!("glb {blockhash} {slot} {block_height}"); + Ok(RpcResponse { context: RpcResponseContext { slot, @@ -254,7 +257,7 @@ impl LiteRpcServer for LiteBridge { }, value: RpcBlockhash { blockhash, - last_valid_block_height: block_height, + last_valid_block_height: block_height + (MAX_RECENT_BLOCKHASHES as u64), }, }) }