From 00f094c37e17e2a0d3ec10b2b4d733b0f10417bd Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 18 Jun 2024 15:53:05 +0800 Subject: [PATCH] core/forkchoice: improve stability when inturn block not generated (#2451) --- core/forkchoice.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/forkchoice.go b/core/forkchoice.go index c42ed24d6..3be956068 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 }