From 993cb7e61cf4b9f629802cbaf501f1fb0a4e85ae Mon Sep 17 00:00:00 2001 From: j75689 Date: Wed, 24 Jul 2024 11:42:22 +0800 Subject: [PATCH] fix: check parent hash of disconnected headers --- crates/bsc/engine/src/task.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/bsc/engine/src/task.rs b/crates/bsc/engine/src/task.rs index e2bffe883..280a28912 100644 --- a/crates/bsc/engine/src/task.rs +++ b/crates/bsc/engine/src/task.rs @@ -310,6 +310,13 @@ impl< } disconnected_headers.push(sealed_header.clone()); } + + // check last header.parent_hash is match the trusted header + if !disconnected_headers.is_empty() && + disconnected_headers.last().unwrap().parent_hash != trusted_header.hash() + { + continue; + } }; // cache header and block