Skip to content

Commit

Permalink
Log progress during header download, bump version number for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-L2L committed Sep 23, 2024
1 parent ae399c4 commit ec1b8c7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ authors = [
"Nikita Chashchinskii <[email protected]>"
]
edition = "2021"
version = "0.9.3"
version = "0.9.4"

[workspace.dependencies.bip300301]
git = "https://github.com/Ash-L2L/bip300301.git"
Expand Down
15 changes: 14 additions & 1 deletion lib/node/mainchain_task.rs
Original file line number Diff line number Diff line change
@@ -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 _},
Expand Down Expand Up @@ -109,8 +112,18 @@ impl MainchainTask {
let mut current_height = None;
let mut headers: Vec<BitcoinHeader> = 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?;
Expand Down

0 comments on commit ec1b8c7

Please sign in to comment.