Skip to content

Commit

Permalink
core/forkchoice: improve stablity when inturn block not generated
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanBSC committed May 13, 2024
1 parent 691d195 commit 83644b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/forkchoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 83644b8

Please sign in to comment.