mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
try-runtime::follow-chain - keep connection (#12167)
* Refactor RPC module * Add flag to `follow-chain` * Multithreading remark * fmt * O_O * unused import * cmon * accidental removal reverted * remove RpcHeaderProvider * mut refs * fmt * no mutability * now? * now? * arc mutex * async mutex * async mutex * uhm * connect in constructor * remove dep * old import * another take * trigger polkadot pipeline * trigger pipeline
This commit is contained in:
committed by
GitHub
parent
d213e95784
commit
198f94f931
@@ -24,7 +24,7 @@ use nix::{
|
||||
unistd::Pid,
|
||||
};
|
||||
use node_primitives::Block;
|
||||
use remote_externalities::rpc_api;
|
||||
use remote_externalities::rpc_api::RpcService;
|
||||
use std::{
|
||||
io::{BufRead, BufReader, Read},
|
||||
ops::{Deref, DerefMut},
|
||||
@@ -71,9 +71,10 @@ pub async fn wait_n_finalized_blocks(
|
||||
pub async fn wait_n_finalized_blocks_from(n: usize, url: &str) {
|
||||
let mut built_blocks = std::collections::HashSet::new();
|
||||
let mut interval = tokio::time::interval(Duration::from_secs(2));
|
||||
let rpc_service = RpcService::new(url, false).await.unwrap();
|
||||
|
||||
loop {
|
||||
if let Ok(block) = rpc_api::get_finalized_head::<Block, _>(url.to_string()).await {
|
||||
if let Ok(block) = rpc_service.get_finalized_head::<Block>().await {
|
||||
built_blocks.insert(block);
|
||||
if built_blocks.len() > n {
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user