From d7a7385fa932d3c7f9e0683bbae46393dd004ff9 Mon Sep 17 00:00:00 2001 From: Nguyen Ba Tam Date: Wed, 7 Nov 2018 18:01:42 +0700 Subject: [PATCH 1/2] update logic find validator --- consensus/posv/posv.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/consensus/posv/posv.go b/consensus/posv/posv.go index c8055ae818..198f8df3b6 100644 --- a/consensus/posv/posv.go +++ b/consensus/posv/posv.go @@ -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 } From 9478c634f2d7527596341caddae40cd8809c0cf7 Mon Sep 17 00:00:00 2001 From: Tuna Date: Sat, 10 Nov 2018 09:59:51 +0700 Subject: [PATCH 2/2] tiny fix --- consensus/posv/posv.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/consensus/posv/posv.go b/consensus/posv/posv.go index 198f8df3b6..82d6c4f164 100644 --- a/consensus/posv/posv.go +++ b/consensus/posv/posv.go @@ -960,7 +960,8 @@ func (c *Posv) RecoverValidator(header *types.Header) (common.Address, error) { if address, known := c.validatorSignatures.Get(hash); known { return address.(common.Address), nil } - // Retrieve the signature from the header extra-data + // Retrieve the signature from the header.Validator + // len equals 65 bytes if len(header.Validator) != extraSeal { return common.Address{}, consensus.ErrMissingValidatorSignature }