mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
update logic find validator
This commit is contained in:
parent
8f4fc42df1
commit
d7a7385fa9
1 changed files with 2 additions and 4 deletions
|
|
@ -961,13 +961,11 @@ func (c *Posv) RecoverValidator(header *types.Header) (common.Address, error) {
|
||||||
return address.(common.Address), nil
|
return address.(common.Address), nil
|
||||||
}
|
}
|
||||||
// Retrieve the signature from the header extra-data
|
// Retrieve the signature from the header extra-data
|
||||||
if len(header.Validator) < extraSeal {
|
if len(header.Validator) != extraSeal {
|
||||||
return common.Address{}, consensus.ErrMissingValidatorSignature
|
return common.Address{}, consensus.ErrMissingValidatorSignature
|
||||||
}
|
}
|
||||||
signature := header.Validator[len(header.Validator)-extraSeal:]
|
|
||||||
|
|
||||||
// Recover the public key and the Ethereum address
|
// 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 {
|
if err != nil {
|
||||||
return common.Address{}, err
|
return common.Address{}, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue