mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 03:31:10 +00:00
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:
committed by
GitHub
parent
293ff64fd0
commit
5c843b3015
Generated
+170
-170
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@
|
|||||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use polkadot_core_primitives::Block;
|
use polkadot_core_primitives::Block;
|
||||||
use remote_externalities::rpc_api::get_finalized_head;
|
use remote_externalities::rpc_api::RpcService;
|
||||||
use std::{
|
use std::{
|
||||||
io::{BufRead, BufReader, Read},
|
io::{BufRead, BufReader, Read},
|
||||||
process::{Child, ExitStatus},
|
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));
|
let mut interval = tokio::time::interval(Duration::from_secs(6));
|
||||||
|
|
||||||
loop {
|
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);
|
built_blocks.insert(block);
|
||||||
if built_blocks.len() > n {
|
if built_blocks.len() > n {
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user