Skip to content

Commit

Permalink
feat: add progress event
Browse files Browse the repository at this point in the history
  • Loading branch information
rustaceanrob committed Nov 1, 2024
1 parent 0a3dfac commit e1eb8d3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions example/signet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ async fn main() {
NodeMessage::ConnectionsMet => {
tracing::info!("Connected to all required peers");
}
_ => (),
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/core/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ impl Dialog {
num_filters: u32,
best_height: u32,
) {
let _ = self.ntx.send(NodeMessage::Progress {
filter_headers: num_cf_headers,
filters: num_filters,
tip_height: best_height,
});
let message = format!(
"Headers ({}/{}) Compact Filter Headers ({}/{}) Filters ({}/{})",
num_headers, best_height, num_cf_headers, best_height, num_filters, best_height
Expand Down
9 changes: 9 additions & 0 deletions src/core/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ pub enum NodeMessage {
Block(IndexedBlock),
/// The node is fully synced, having scanned the requested range.
Synced(SyncUpdate),
/// The progress of the node during the block filter download process.
Progress {
/// The number of filter headers that have been assumed checked and downloaded.
filter_headers: u32,
/// The number of block filters that have been assumed checked and downloaded.
filters: u32,
/// The best known height to the tip of the chain.
tip_height: u32,
},
/// Blocks were reorganized out of the chain.
BlocksDisconnected(Vec<DisconnectedHeader>),
/// A transaction was sent to one or more connected peers.
Expand Down

0 comments on commit e1eb8d3

Please sign in to comment.