Skip to content

Commit

Permalink
fix(collation-manager): skip validation result if block already remov…
Browse files Browse the repository at this point in the history
…ed from cache
  • Loading branch information
SmaGMan authored and Rexagon committed Jul 8, 2024
1 parent 42dd7cd commit df4e3df
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions collator/src/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,14 @@ where
"Saving block validation result to cache...",
);
// update block in cache with signatures info
self.store_block_validation_result(block_id, validation_result)?;
let updated = self.store_block_validation_result(block_id, validation_result);
if !updated {
tracing::debug!(
target: tracing_targets::COLLATION_MANAGER,
"Block does not exist in cache - skip validation result",
);
return Ok(());
}

// process valid block
if block_id.shard.is_masterchain() {
Expand Down Expand Up @@ -1402,7 +1409,7 @@ where
&mut self,
block_id: BlockId,
validation_result: OnValidatedBlockEvent,
) -> Result<&BlockCandidateContainer> {
) -> bool {
if let Some(block_container) = if block_id.is_masterchain() {
self.blocks_cache.master.get_mut(&block_id.as_short_id())
} else {
Expand All @@ -1419,9 +1426,9 @@ where

block_container.set_validation_result(is_valid, already_synced, signatures);

Ok(block_container)
true
} else {
bail!("Block ({}) does not exist in cache!", block_id)
false
}
}

Expand Down

0 comments on commit df4e3df

Please sign in to comment.