update logic find validator

This commit is contained in:
Nguyen Ba Tam 2018-11-07 18:01:42 +07:00
parent 8f4fc42df1
commit d7a7385fa9

View file

@ -961,13 +961,11 @@ func (c *Posv) RecoverValidator(header *types.Header) (common.Address, error) {
return address.(common.Address), nil
}
// Retrieve the signature from the header extra-data
if len(header.Validator) < extraSeal {
if len(header.Validator) != extraSeal {
return common.Address{}, consensus.ErrMissingValidatorSignature
}
signature := header.Validator[len(header.Validator)-extraSeal:]
// Recover the public key and the Ethereum address
pubkey, err := crypto.Ecrecover(sigHash(header).Bytes(), signature)
pubkey, err := crypto.Ecrecover(sigHash(header).Bytes(), header.Validator)
if err != nil {
return common.Address{}, err
}