Skip to content

Commit

Permalink
Avoid cloning snapshots during sync
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Jun 15, 2022
1 parent 564d7da commit 71e9ab0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion beacon_node/beacon_chain/src/snapshot_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ impl<T: EthSpec> SnapshotCache<T> {
.position(|snapshot| snapshot.beacon_block_root == block_root)
.map(|i| {
if let Some(cache) = self.snapshots.get(i) {
if block_slot > cache.beacon_block.slot() + 1 {
// Avoid cloning the block during sync (when the `block_delay` is `None`).
if block_slot > cache.beacon_block.slot() + 1 && block_delay.is_some() {
return (cache.clone_as_pre_state(), true);
}
if let Some(delay) = block_delay {
Expand Down

0 comments on commit 71e9ab0

Please sign in to comment.