mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-01-12 22:43:06 +08:00
feat: add --check-blocks-integrity flag
This commit is contained in:
@@ -339,6 +339,9 @@ struct StartCommand {
|
||||
/// HTTP Auth token
|
||||
#[clap(long = "auth-token")]
|
||||
pub auth_token: Option<String>,
|
||||
/// Check blocks integrity
|
||||
#[clap(long = "check-blocks-integrity")]
|
||||
pub block_integrity_check: bool,
|
||||
}
|
||||
|
||||
#[derive(Subcommand, PartialEq, Clone, Debug)]
|
||||
@@ -740,7 +743,9 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
|
||||
}
|
||||
|
||||
let mut service = Service::new(config, ctx.clone());
|
||||
return service.run(predicates, None).await;
|
||||
return service
|
||||
.run(predicates, None, cmd.block_integrity_check)
|
||||
.await;
|
||||
}
|
||||
},
|
||||
Command::Config(subcmd) => match subcmd {
|
||||
|
||||
@@ -67,11 +67,14 @@ impl Service {
|
||||
predicate_activity_relayer: Option<
|
||||
crossbeam_channel::Sender<BitcoinChainhookOccurrencePayload>,
|
||||
>,
|
||||
check_blocks_integrity: bool,
|
||||
) -> Result<(), String> {
|
||||
let mut event_observer_config = self.config.get_event_observer_config();
|
||||
|
||||
// Catch-up with chain tip
|
||||
let chain_tip_height = self.catch_up_with_chain_tip(false, false).await?;
|
||||
let chain_tip_height = self
|
||||
.catch_up_with_chain_tip(false, check_blocks_integrity)
|
||||
.await?;
|
||||
info!(
|
||||
self.ctx.expect_logger(),
|
||||
"Database up to date, service will start streaming blocks"
|
||||
|
||||
Reference in New Issue
Block a user