Skip to content

Commit

Permalink
fix: check hash value of sealed headers to prevent incomplete headers
Browse files Browse the repository at this point in the history
  • Loading branch information
j75689 committed Jul 25, 2024
1 parent 3d8df4a commit d34b42c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/bsc/engine/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,21 @@ impl<
if !is_valid_header {
continue
};
// check if the header is the same as the block hash
// that probably means the block is not sealed yet
let block_hash = match info.block_hash {
BlockHashOrNumber::Hash(hash) => hash,
BlockHashOrNumber::Number(number) => {
// trigger by the interval tick, can only trust the number
if number != sealed_header.number {
continue;
}
sealed_header.hash()
}
};
if sealed_header.hash() != block_hash {
continue;
}

let mut disconnected_headers = Vec::new();
disconnected_headers.push(sealed_header.clone());
Expand Down

0 comments on commit d34b42c

Please sign in to comment.