From 83644b8a5d4ea9abd2081f183c4617f151cdc217 Mon Sep 17 00:00:00 2001 From: NathanBSC Date: Mon, 13 May 2024 16:05:30 +0800 Subject: [PATCH] core/forkchoice: improve stablity when inturn block not generated --- core/forkchoice.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/forkchoice.go b/core/forkchoice.go index c42ed24d6f..3be956068d 100644 --- a/core/forkchoice.go +++ b/core/forkchoice.go @@ -114,7 +114,9 @@ func (f *ForkChoice) ReorgNeeded(current *types.Header, extern *types.Header) (b if f.preserve != nil { currentPreserve, externPreserve = f.preserve(current), f.preserve(extern) } - reorg = !currentPreserve && (externPreserve || f.rand.Float64() < 0.5) + reorg = !currentPreserve && (externPreserve || + extern.Time < current.Time || + extern.Time == current.Time && f.rand.Float64() < 0.5) } return reorg, nil }