From 824d4a8f640653e9f30de13bc4870c26a7711d94 Mon Sep 17 00:00:00 2001 From: minh-bq <97180373+minh-bq@users.noreply.github.com> Date: Mon, 25 Nov 2024 14:18:16 +0700 Subject: [PATCH] consortium-v2: only return when failing to verify extraData (#636) In commit 584db0f668 ("consortium-v2: move extraData check with contract into a function"), we refactor the code and mistakenly return even if we successfully verify extraData. Fix it by checking the error and only return if there is an error when verifying extraData. --- consensus/consortium/v2/consortium.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/consensus/consortium/v2/consortium.go b/consensus/consortium/v2/consortium.go index 83bc8162a..cd7682c0d 100644 --- a/consensus/consortium/v2/consortium.go +++ b/consensus/consortium/v2/consortium.go @@ -1304,11 +1304,15 @@ func (c *Consortium) Finalize(chain consensus.ChainHeaderReader, header *types.H } } if c.IsPeriodBlock(chain, header, nil) { - return verifyValidatorExtraDataWithContract(checkpointValidators, extraData, true, true) + if err := verifyValidatorExtraDataWithContract(checkpointValidators, extraData, true, true); err != nil { + return err + } } } else { isShillin := c.chainConfig.IsShillin(header.Number) - return verifyValidatorExtraDataWithContract(checkpointValidators, extraData, isShillin, false) + if err := verifyValidatorExtraDataWithContract(checkpointValidators, extraData, isShillin, false); err != nil { + return err + } } }