Skip to content

Commit d7d90e7

Browse files
author
Ludo Galabru
committed
feat: add --check-blocks-integrity flag
1 parent 424f5bb commit d7d90e7

File tree

2 files changed

+10
-2
lines changed
  • components

2 files changed

+10
-2
lines changed

components/ordhook-cli/src/cli/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,9 @@ struct StartCommand {
339339
/// HTTP Auth token
340340
#[clap(long = "auth-token")]
341341
pub auth_token: Option<String>,
342+
/// Check blocks integrity
343+
#[clap(long = "check-blocks-integrity")]
344+
pub block_integrity_check: bool,
342345
}
343346

344347
#[derive(Subcommand, PartialEq, Clone, Debug)]
@@ -740,7 +743,9 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
740743
}
741744

742745
let mut service = Service::new(config, ctx.clone());
743-
return service.run(predicates, None).await;
746+
return service
747+
.run(predicates, None, cmd.block_integrity_check)
748+
.await;
744749
}
745750
},
746751
Command::Config(subcmd) => match subcmd {

components/ordhook-core/src/service/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ impl Service {
6767
predicate_activity_relayer: Option<
6868
crossbeam_channel::Sender<BitcoinChainhookOccurrencePayload>,
6969
>,
70+
check_blocks_integrity: bool,
7071
) -> Result<(), String> {
7172
let mut event_observer_config = self.config.get_event_observer_config();
7273

7374
// Catch-up with chain tip
74-
let chain_tip_height = self.catch_up_with_chain_tip(false, false).await?;
75+
let chain_tip_height = self
76+
.catch_up_with_chain_tip(false, check_blocks_integrity)
77+
.await?;
7578
info!(
7679
self.ctx.expect_logger(),
7780
"Database up to date, service will start streaming blocks"

0 commit comments

Comments
 (0)