mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-06-29 18:39:30 +00:00
feat(indexer): run genesis-consistency check at service and FFI startup
This commit is contained in:
parent
e04626063f
commit
5c48dab887
@ -112,10 +112,17 @@ unsafe fn setup_indexer(
|
||||
unsafe { Runtime::from_borrowed(caller.as_ref()) }
|
||||
};
|
||||
|
||||
let core = IndexerCore::new(config, &storage_dir).map_err(|e| {
|
||||
log::error!("Could not initialize indexer core: {e}");
|
||||
OperationStatus::InitializationError
|
||||
})?;
|
||||
let allow_reset = config.allow_chain_reset;
|
||||
let core = runtime
|
||||
.block_on(IndexerCore::new_with_genesis_check(
|
||||
config,
|
||||
&storage_dir,
|
||||
allow_reset,
|
||||
))
|
||||
.map_err(|e| {
|
||||
log::error!("Could not initialize indexer core: {e}");
|
||||
OperationStatus::InitializationError
|
||||
})?;
|
||||
|
||||
// The block stream writes each parsed block into the store as a side effect
|
||||
// of being polled, so we spawn a task that simply drains it. There are no
|
||||
|
||||
@ -3,5 +3,6 @@
|
||||
"bedrock_config": {
|
||||
"addr": "http://localhost:18080"
|
||||
},
|
||||
"channel_id": "0101010101010101010101010101010101010101010101010101010101010101"
|
||||
"channel_id": "0101010101010101010101010101010101010101010101010101010101010101",
|
||||
"allow_chain_reset": false
|
||||
}
|
||||
|
||||
@ -87,6 +87,7 @@ pub async fn run_server(
|
||||
#[cfg(not(feature = "mock-responses"))]
|
||||
let handle = {
|
||||
let service = service::IndexerService::new(config, storage_dir)
|
||||
.await
|
||||
.context("Failed to initialize indexer service")?;
|
||||
server.start(service.into_rpc())
|
||||
};
|
||||
|
||||
@ -19,8 +19,9 @@ pub struct IndexerService {
|
||||
}
|
||||
|
||||
impl IndexerService {
|
||||
pub fn new(config: IndexerConfig, storage_dir: &Path) -> Result<Self> {
|
||||
let indexer = IndexerCore::new(config, storage_dir)?;
|
||||
pub async fn new(config: IndexerConfig, storage_dir: &Path) -> Result<Self> {
|
||||
let allow_reset = config.allow_chain_reset;
|
||||
let indexer = IndexerCore::new_with_genesis_check(config, storage_dir, allow_reset).await?;
|
||||
let subscription_service = SubscriptionService::spawn_new(indexer.clone());
|
||||
|
||||
Ok(Self {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user