diff --git a/Cargo.lock b/Cargo.lock index 7db7b0c..5aceb7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4532,7 +4532,7 @@ dependencies = [ [[package]] name = "thunder" -version = "0.9.3" +version = "0.9.4" dependencies = [ "anyhow", "bincode", @@ -4570,7 +4570,7 @@ dependencies = [ [[package]] name = "thunder_app" -version = "0.9.3" +version = "0.9.4" dependencies = [ "anyhow", "base64 0.21.7", @@ -4607,7 +4607,7 @@ dependencies = [ [[package]] name = "thunder_app_cli" -version = "0.9.3" +version = "0.9.4" dependencies = [ "anyhow", "bip300301", @@ -4622,7 +4622,7 @@ dependencies = [ [[package]] name = "thunder_app_rpc_api" -version = "0.9.3" +version = "0.9.4" dependencies = [ "bip300301", "jsonrpsee", diff --git a/Cargo.toml b/Cargo.toml index 7975000..1ac1297 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ authors = [ "Nikita Chashchinskii " ] edition = "2021" -version = "0.9.3" +version = "0.9.4" [workspace.dependencies.bip300301] git = "https://github.com/Ash-L2L/bip300301.git" diff --git a/lib/node/mainchain_task.rs b/lib/node/mainchain_task.rs index bfd002a..d8c08ba 100644 --- a/lib/node/mainchain_task.rs +++ b/lib/node/mainchain_task.rs @@ -1,6 +1,9 @@ //! Task to communicate with mainchain node -use std::sync::Arc; +use std::{ + sync::Arc, + time::{Duration, Instant}, +}; use bip300301::{ bitcoin::{self, hashes::Hash as _}, @@ -109,8 +112,18 @@ impl MainchainTask { let mut current_height = None; let mut headers: Vec = Vec::new(); tracing::debug!(%block_hash, "requesting ancestor headers"); + const LOG_PROGRESS_INTERVAL: Duration = Duration::from_secs(5); + let mut progress_logged = Instant::now(); loop { if let Some(current_height) = current_height { + let now = Instant::now(); + if now.duration_since(progress_logged) >= LOG_PROGRESS_INTERVAL + { + progress_logged = now; + tracing::debug!( + %block_hash, + "requesting ancestor headers: {current_block_hash}({current_height} remaining)"); + } tracing::trace!(%block_hash, "requesting ancestor headers: {current_block_hash}({current_height})") } let header = drivechain.get_header(current_block_hash).await?;