Skip to content

Commit

Permalink
rename hook action, add todo item
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Sep 19, 2023
1 parent 33123ae commit fcb3608
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions crates/consensus/beacon/src/engine/hooks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ impl EngineHookEvent {
pub enum EngineHookAction {
/// Notify about a [SyncState] update.
UpdateSyncState(SyncState),
/// Read the last relevant canonical hashes from the database and update the block indices of
/// the blockchain tree.
RestoreCanonicalHashes,
/// Connect blocks buffered during the hook execution to canonical hashes.
ConnectBufferedBlocks,
}

/// An error returned by [hook][`EngineHook`].
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/beacon/src/engine/hooks/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<DB: Database + 'static> PruneHook<DB> {
};

let action = if matches!(event, EngineHookEvent::Finished(Ok(_))) {
Some(EngineHookAction::RestoreCanonicalHashes)
Some(EngineHookAction::ConnectBufferedBlocks)
} else {
None
};
Expand Down
4 changes: 3 additions & 1 deletion crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,9 @@ where
EngineHookAction::UpdateSyncState(state) => {
self.sync_state_updater.update_sync_state(state)
}
EngineHookAction::RestoreCanonicalHashes => {
// TODO(alexey): always connect buffered blocks if hook had the
// `EngineHookDBAccessLevel::ReadWrite`
EngineHookAction::ConnectBufferedBlocks => {
if let Err(error) = self.blockchain.connect_buffered_blocks_to_canonical_hashes() {
error!(target: "consensus::engine", ?error, "Error restoring blockchain tree state");
return Err(error.into())
Expand Down

0 comments on commit fcb3608

Please sign in to comment.