mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-10 13:01:22 +00:00
Help user configure blobs freezer correctly between start ups
This commit is contained in:
parent
05c51b37b1
commit
0ba0775812
@ -94,13 +94,14 @@ pub enum HotColdDBError {
|
|||||||
MissingRestorePointHash(u64),
|
MissingRestorePointHash(u64),
|
||||||
MissingRestorePoint(Hash256),
|
MissingRestorePoint(Hash256),
|
||||||
MissingColdStateSummary(Hash256),
|
MissingColdStateSummary(Hash256),
|
||||||
MissingColdBlobs(Hash256),
|
|
||||||
MissingHotStateSummary(Hash256),
|
MissingHotStateSummary(Hash256),
|
||||||
|
MissingColdBlobs(Hash256),
|
||||||
MissingEpochBoundaryState(Hash256),
|
MissingEpochBoundaryState(Hash256),
|
||||||
MissingSplitState(Hash256, Slot),
|
MissingSplitState(Hash256, Slot),
|
||||||
MissingExecutionPayload(Hash256),
|
MissingExecutionPayload(Hash256),
|
||||||
MissingFullBlockExecutionPayloadPruned(Hash256, Slot),
|
MissingFullBlockExecutionPayloadPruned(Hash256, Slot),
|
||||||
MissingAnchorInfo,
|
MissingAnchorInfo,
|
||||||
|
MissingPathToBlobsFreezer,
|
||||||
HotStateSummaryError(BeaconStateError),
|
HotStateSummaryError(BeaconStateError),
|
||||||
RestorePointDecodeError(ssz::DecodeError),
|
RestorePointDecodeError(ssz::DecodeError),
|
||||||
BlockReplayBeaconError(BeaconStateError),
|
BlockReplayBeaconError(BeaconStateError),
|
||||||
@ -169,18 +170,12 @@ impl<E: EthSpec> HotColdDB<E, LevelDB<E>, LevelDB<E>> {
|
|||||||
) -> Result<Arc<Self>, Error> {
|
) -> Result<Arc<Self>, Error> {
|
||||||
Self::verify_slots_per_restore_point(config.slots_per_restore_point)?;
|
Self::verify_slots_per_restore_point(config.slots_per_restore_point)?;
|
||||||
|
|
||||||
let cold_blobs_db = if let Some(path) = cold_blobs_path {
|
|
||||||
Some(LevelDB::open(path.as_path())?)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut db = HotColdDB {
|
let mut db = HotColdDB {
|
||||||
split: RwLock::new(Split::default()),
|
split: RwLock::new(Split::default()),
|
||||||
anchor_info: RwLock::new(None),
|
anchor_info: RwLock::new(None),
|
||||||
blob_info: RwLock::new(BlobInfo::default()),
|
blob_info: RwLock::new(BlobInfo::default()),
|
||||||
cold_db: LevelDB::open(cold_path)?,
|
cold_db: LevelDB::open(cold_path)?,
|
||||||
cold_blobs_db,
|
cold_blobs_db: None,
|
||||||
hot_db: LevelDB::open(hot_path)?,
|
hot_db: LevelDB::open(hot_path)?,
|
||||||
block_cache: Mutex::new(LruCache::new(config.block_cache_size)),
|
block_cache: Mutex::new(LruCache::new(config.block_cache_size)),
|
||||||
blob_cache: Mutex::new(LruCache::new(config.blob_cache_size)),
|
blob_cache: Mutex::new(LruCache::new(config.blob_cache_size)),
|
||||||
@ -225,6 +220,25 @@ impl<E: EthSpec> HotColdDB<E, LevelDB<E>, LevelDB<E>> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if db.spec.eip4844_fork_epoch.is_some() {
|
||||||
|
let blob_info = match db.load_blob_info()? {
|
||||||
|
Some(mut blob_info) => {
|
||||||
|
if blob_info.blobs_freezer {
|
||||||
|
cold_blobs_path
|
||||||
|
.as_ref()
|
||||||
|
.ok_or(HotColdDBError::MissingPathToBlobsFreezer)?;
|
||||||
|
}
|
||||||
|
if let Some(path) = cold_blobs_path {
|
||||||
|
db.cold_blobs_db = Some(LevelDB::open(path.as_path())?);
|
||||||
|
blob_info.blobs_freezer = true;
|
||||||
|
}
|
||||||
|
Some(blob_info)
|
||||||
|
}
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
*db.blob_info.write() = blob_info;
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure that the schema version of the on-disk database matches the software.
|
// Ensure that the schema version of the on-disk database matches the software.
|
||||||
// If the version is mismatched, an automatic migration will be attempted.
|
// If the version is mismatched, an automatic migration will be attempted.
|
||||||
let db = Arc::new(db);
|
let db = Arc::new(db);
|
||||||
|
Loading…
Reference in New Issue
Block a user