Skip to content

Commit 719e7ee

Browse files
committed
Fix block root index bug in migration
1 parent d1b215f commit 719e7ee

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

beacon_node/store/src/hot_cold_store.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,6 +2147,7 @@ pub fn migrate_database<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>>(
21472147
}
21482148

21492149
// Copy the blinded block from the hot database to the freezer.
2150+
// FIXME(sproul): make this load lazy
21502151
let blinded_block = store
21512152
.get_blinded_block(&block_root, None)?
21522153
.ok_or(Error::BlockNotFound(block_root))?;
@@ -2158,6 +2159,15 @@ pub fn migrate_database<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>>(
21582159
)?;
21592160
}
21602161

2162+
// Store the slot to block root mapping.
2163+
cold_db_block_ops.push(KeyValueStoreOp::PutKeyValue(
2164+
get_key_for_col(
2165+
DBColumn::BeaconBlockRoots.into(),
2166+
&slot.as_u64().to_be_bytes(),
2167+
),
2168+
block_root.as_bytes().to_vec(),
2169+
));
2170+
21612171
// Delete the old summary, and the full state if we lie on an epoch boundary.
21622172
hot_db_ops.push(StoreOp::DeleteState(state_root, Some(slot)));
21632173

0 commit comments

Comments
 (0)