add MAX_RECENT_BLOCKHASSHES and some logs (#49)

This commit is contained in:
Aniket Prajapati 2023-02-06 20:45:26 +05:30 committed by GitHub
parent 1e60c090ea
commit c92ce5074d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -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),
},
})
}