Skip to content

Commit

Permalink
consortium-v2: only return when failing to verify extraData (#636)
Browse files Browse the repository at this point in the history
In commit 584db0f ("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.
  • Loading branch information
minh-bq authored Nov 25, 2024
1 parent d18bde2 commit 824d4a8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions consensus/consortium/v2/consortium.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit 824d4a8

Please sign in to comment.