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:
Piotr Mikołajczyk
2022-09-06 10:01:35 +02:00
committed by GitHub
parent d213e95784
commit 198f94f931
6 changed files with 161 additions and 107 deletions
+3 -2
View File
@@ -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