From 432085ea623b643975b569633923705d731415d8 Mon Sep 17 00:00:00 2001 From: Roshan <48975233+Pythonberg1997@users.noreply.github.com> Date: Mon, 25 Dec 2023 11:20:50 +0800 Subject: [PATCH] fix: avoid update validators on Feynman block (#2102) --- consensus/parlia/parlia.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/consensus/parlia/parlia.go b/consensus/parlia/parlia.go index be68ce2ed..d17e1ea20 100644 --- a/consensus/parlia/parlia.go +++ b/consensus/parlia/parlia.go @@ -1177,8 +1177,11 @@ func (p *Parlia) Finalize(chain consensus.ChainHeaderReader, header *types.Heade // update validators every day if p.chainConfig.IsFeynman(header.Number, header.Time) && isBreatheBlock(parent.Time, header.Time) { - if err := p.updateValidatorSetV2(state, header, cx, txs, receipts, systemTxs, usedGas, false); err != nil { - return err + // we should avoid update validators in the Feynman upgrade block + if !p.chainConfig.IsOnFeynman(header.Number, parent.Time, header.Time) { + if err := p.updateValidatorSetV2(state, header, cx, txs, receipts, systemTxs, usedGas, false); err != nil { + return err + } } } @@ -1257,8 +1260,11 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header * // update validators every day if p.chainConfig.IsFeynman(header.Number, header.Time) && isBreatheBlock(parent.Time, header.Time) { - if err := p.updateValidatorSetV2(state, header, cx, &txs, &receipts, nil, &header.GasUsed, true); err != nil { - return nil, nil, err + // we should avoid update validators in the Feynman upgrade block + if !p.chainConfig.IsOnFeynman(header.Number, parent.Time, header.Time) { + if err := p.updateValidatorSetV2(state, header, cx, &txs, &receipts, nil, &header.GasUsed, true); err != nil { + return nil, nil, err + } } }