constant
This commit is contained in:
parent
84bd7356e8
commit
b1885e0ea2
|
@ -1,21 +1,23 @@
|
|||
use lite_rpc::DEFAULT_LITE_RPC_ADDR;
|
||||
use solana_rpc_client::nonblocking::rpc_client::RpcClient;
|
||||
|
||||
const BLOCKHASH_INTERVAL_MS: u64 = 3000;
|
||||
|
||||
#[tokio::test]
|
||||
async fn blockhash() -> anyhow::Result<()> {
|
||||
let lite_rpc = RpcClient::new(DEFAULT_LITE_RPC_ADDR.to_string());
|
||||
|
||||
let mut prev_blockhash = lite_rpc.get_latest_blockhash().await.unwrap();
|
||||
|
||||
for _ in 0..60 {
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(3000)).await;
|
||||
for _ in 0..10 {
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(BLOCKHASH_INTERVAL_MS)).await;
|
||||
|
||||
let blockhash = lite_rpc.get_latest_blockhash().await.unwrap();
|
||||
|
||||
if prev_blockhash != blockhash {
|
||||
prev_blockhash = blockhash;
|
||||
} else {
|
||||
panic!("Blockhash didn't change in appx 500ms");
|
||||
panic!("Blockhash didn't change in appx {BLOCKHASH_INTERVAL_MS}ms");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue