Skip to content

Commit

Permalink
try_connect_buffered_blocks: add check for InsertPayloadOk::Inserted(…
Browse files Browse the repository at this point in the history
…BlockStatus::Valid
  • Loading branch information
fgimenez committed Aug 7, 2024
1 parent 2b4046d commit b5b1b34
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,14 @@ where
match self.insert_block(child) {
Ok(res) => {
debug!(target: "engine", child =?child_num_hash, ?res, "connected buffered block");
if self.is_sync_target_head(child_num_hash.hash) {
if self.is_sync_target_head(child_num_hash.hash) &&
matches!(
res,
InsertPayloadOk::Inserted(BlockStatus::Valid(
BlockAttachment::Canonical
))
)
{
self.make_canonical(child_num_hash.hash);
}
}
Expand Down

0 comments on commit b5b1b34

Please sign in to comment.