mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-24 08:18:25 +00:00
Optionally check DB invariants at runtime (#8952)
Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,7 @@ use beacon_chain::store::metadata::CURRENT_SCHEMA_VERSION;
|
||||
use beacon_chain::{BeaconChain, BeaconChainTypes};
|
||||
use serde::Serialize;
|
||||
use std::sync::Arc;
|
||||
use store::invariants::InvariantCheckResult;
|
||||
use store::{AnchorInfo, BlobInfo, Split, StoreConfig};
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
@@ -30,3 +31,11 @@ pub fn info<T: BeaconChainTypes>(
|
||||
blob_info,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn check_invariants<T: BeaconChainTypes>(
|
||||
chain: Arc<BeaconChain<T>>,
|
||||
) -> Result<InvariantCheckResult, warp::Rejection> {
|
||||
chain.check_database_invariants().map_err(|e| {
|
||||
warp_utils::reject::custom_bad_request(format!("error checking database invariants: {e:?}"))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user