From 451f027732639a8d9dfcfb6268ebcc887f821c58 Mon Sep 17 00:00:00 2001 From: Sebastian Miasojed Date: Fri, 23 Jun 2023 13:35:53 +0200 Subject: [PATCH] Changed block subscription from finalized to best (#23) --- src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 6560548..53344d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -76,9 +76,16 @@ pub async fn subscribe_stats( url: &str, ) -> Result + Unpin, Error> { let client = OnlineClient::::from_url(url).await?; + subscribe_stats_with_client(client).await +} + +/// Connect to the specified node and listen for new blocks using OnlineClient. +pub async fn subscribe_stats_with_client( + client: OnlineClient, +) -> Result + Unpin, Error> { let client = Arc::new(client); - let blocks = client.blocks().subscribe_finalized().await?; + let blocks = client.blocks().subscribe_best().await?; let max_block_weights: BlockWeights = { let metadata = client.metadata();