Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(zebra-scan): Connect with zebrad #7989

Merged
merged 6 commits into from
Nov 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix the task handler
  • Loading branch information
oxarbitrage committed Nov 24, 2023
commit cd8b0fd36845e1f96112bb95b6c6455c03a6a737
11 changes: 7 additions & 4 deletions zebrad/src/commands/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ impl StartCmd {

tokio::spawn(zebra_scan::scan::start(state, storage).in_current_span())
};
#[cfg(not(feature = "zebra-scan"))]
// Spawn a dummy scan task which doesn't do anything and never finishes.
let scan_task_handle: tokio::task::JoinHandle<Result<(), Report>> =
tokio::spawn(std::future::pending().in_current_span());

info!("spawned initial Zebra tasks");

Expand All @@ -312,7 +316,6 @@ impl StartCmd {
pin!(tx_gossip_task_handle);
pin!(progress_task_handle);
pin!(end_of_support_task_handle);
#[cfg(feature = "zebra-scan")]
pin!(scan_task_handle);

// startup tasks
Expand Down Expand Up @@ -401,7 +404,9 @@ impl StartCmd {
Ok(())
}

// TODO: add scan task which is tricky because it needs to be behind a feature.
scan_result = &mut scan_task_handle => scan_result
.expect("unexpected panic in the scan task")
.map(|_| info!("scan task exited")),
};

// Stop Zebra if a task finished and returned an error,
Expand All @@ -427,8 +432,6 @@ impl StartCmd {
tx_gossip_task_handle.abort();
progress_task_handle.abort();
end_of_support_task_handle.abort();

#[cfg(feature = "zebra-scan")]
scan_task_handle.abort();

// startup tasks
Expand Down
Loading