mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 20:57:10 +00:00
Fix v10/v20 mixup
This commit is contained in:
@@ -28,6 +28,8 @@ pub fn migrate_schema<T: BeaconChainTypes>(
|
|||||||
(_, _) if from == to && to == CURRENT_SCHEMA_VERSION => Ok(()),
|
(_, _) if from == to && to == CURRENT_SCHEMA_VERSION => Ok(()),
|
||||||
// Upgrade for tree-states database changes.
|
// Upgrade for tree-states database changes.
|
||||||
(SchemaVersion(9), SchemaVersion(20)) => migration_schema_v20::upgrade_to_v20::<T>(db, log),
|
(SchemaVersion(9), SchemaVersion(20)) => migration_schema_v20::upgrade_to_v20::<T>(db, log),
|
||||||
|
// FIXME(sproul): this is a temporary patch remove it before merging
|
||||||
|
(SchemaVersion(10), SchemaVersion(20)) => db.store_schema_version(to),
|
||||||
// Downgrade for tree-states database changes.
|
// Downgrade for tree-states database changes.
|
||||||
(SchemaVersion(20), SchemaVersion(9)) => {
|
(SchemaVersion(20), SchemaVersion(9)) => {
|
||||||
migration_schema_v20::downgrade_from_v20::<T>(db, log)
|
migration_schema_v20::downgrade_from_v20::<T>(db, log)
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ pub fn upgrade_to_v20<T: BeaconChainTypes>(
|
|||||||
let prev_state_root = *current_state.get_state_root(slot - 1)?;
|
let prev_state_root = *current_state.get_state_root(slot - 1)?;
|
||||||
let epoch_boundary_state_root = *current_state.get_state_root(epoch_boundary_slot)?;
|
let epoch_boundary_state_root = *current_state.get_state_root(epoch_boundary_slot)?;
|
||||||
|
|
||||||
|
// FIXME(sproul): rename V10 variant
|
||||||
let summary = HotStateSummaryV10 {
|
let summary = HotStateSummaryV10 {
|
||||||
slot,
|
slot,
|
||||||
latest_block_root,
|
latest_block_root,
|
||||||
@@ -189,7 +190,7 @@ pub fn upgrade_to_v20<T: BeaconChainTypes>(
|
|||||||
ops.push(summary.as_kv_store_op(state_root)?);
|
ops.push(summary.as_kv_store_op(state_root)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
db.store_schema_version_atomically(SchemaVersion(10), ops)
|
db.store_schema_version_atomically(SchemaVersion(20), ops)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn downgrade_from_v20<T: BeaconChainTypes>(
|
pub fn downgrade_from_v20<T: BeaconChainTypes>(
|
||||||
|
|||||||
Reference in New Issue
Block a user