Companion for: try-runtime::follow-chain - keep connection (#5968)

* Adjust to the new API

* Remove mutability

* Async constructor

* unwrap result

* do not panic

* suggestion

* leftover

* update lockfile for {"substrate"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Piotr Mikołajczyk
2022-09-06 10:46:12 +02:00
committed by GitHub
parent 293ff64fd0
commit 5c843b3015
2 changed files with 177 additions and 172 deletions
+7 -2
View File
@@ -15,7 +15,7 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use polkadot_core_primitives::Block;
use remote_externalities::rpc_api::get_finalized_head;
use remote_externalities::rpc_api::RpcService;
use std::{
io::{BufRead, BufReader, Read},
process::{Child, ExitStatus},
@@ -56,7 +56,12 @@ async fn wait_n_finalized_blocks_from(n: usize, url: &str) {
let mut interval = tokio::time::interval(Duration::from_secs(6));
loop {
if let Ok(block) = get_finalized_head::<Block, _>(url).await {
let rpc_service = match RpcService::new(url, false).await {
Ok(rpc_service) => rpc_service,
Err(_) => continue,
};
if let Ok(block) = rpc_service.get_finalized_head::<Block>().await {
built_blocks.insert(block);
if built_blocks.len() > n {
break