mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
ignore faster with block no validator m2
This commit is contained in:
parent
407a556362
commit
08cda1ba0c
4 changed files with 9 additions and 4 deletions
|
|
@ -35,5 +35,7 @@ var (
|
||||||
// plus one.
|
// plus one.
|
||||||
ErrInvalidNumber = errors.New("invalid block number")
|
ErrInvalidNumber = errors.New("invalid block number")
|
||||||
|
|
||||||
ErrMissingValidatorSignature = errors.New("missing validator in header")
|
ErrFailValidatorSignature = errors.New("missing validator in header")
|
||||||
|
|
||||||
|
ErrNoValidatorSignature = errors.New("no validator in header")
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -370,6 +370,9 @@ func (c *Posv) verifyCascadingFields(chain consensus.ChainReader, header *types.
|
||||||
if parent.Time.Uint64()+c.config.Period > header.Time.Uint64() {
|
if parent.Time.Uint64()+c.config.Period > header.Time.Uint64() {
|
||||||
return ErrInvalidTimestamp
|
return ErrInvalidTimestamp
|
||||||
}
|
}
|
||||||
|
if header.Number.Uint64() > c.config.Epoch && len(header.Validator) == 0 {
|
||||||
|
return consensus.ErrNoValidatorSignature
|
||||||
|
}
|
||||||
// Retrieve the snapshot needed to verify this header and cache it
|
// Retrieve the snapshot needed to verify this header and cache it
|
||||||
snap, err := c.snapshot(chain, number-1, header.ParentHash, parents)
|
snap, err := c.snapshot(chain, number-1, header.ParentHash, parents)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -959,7 +962,7 @@ func (c *Posv) RecoverValidator(header *types.Header) (common.Address, error) {
|
||||||
// Retrieve the signature from the header.Validator
|
// Retrieve the signature from the header.Validator
|
||||||
// len equals 65 bytes
|
// len equals 65 bytes
|
||||||
if len(header.Validator) != extraSeal {
|
if len(header.Validator) != extraSeal {
|
||||||
return common.Address{}, consensus.ErrMissingValidatorSignature
|
return common.Address{}, consensus.ErrFailValidatorSignature
|
||||||
}
|
}
|
||||||
// Recover the public key and the Ethereum address
|
// Recover the public key and the Ethereum address
|
||||||
pubkey, err := crypto.Ecrecover(sigHash(header).Bytes(), header.Validator)
|
pubkey, err := crypto.Ecrecover(sigHash(header).Bytes(), header.Validator)
|
||||||
|
|
|
||||||
|
|
@ -669,7 +669,7 @@ func (f *Fetcher) insert(peer string, block *types.Block) {
|
||||||
time.Sleep(delay)
|
time.Sleep(delay)
|
||||||
log.Info("Receive future block", "number", block.NumberU64(), "hash", block.Hash().Hex(), "delay", delay)
|
log.Info("Receive future block", "number", block.NumberU64(), "hash", block.Hash().Hex(), "delay", delay)
|
||||||
goto again
|
goto again
|
||||||
case consensus.ErrMissingValidatorSignature:
|
case consensus.ErrNoValidatorSignature:
|
||||||
newBlock := block
|
newBlock := block
|
||||||
if f.appendM2HeaderHook != nil {
|
if f.appendM2HeaderHook != nil {
|
||||||
if newBlock, err = f.appendM2HeaderHook(block); err != nil {
|
if newBlock, err = f.appendM2HeaderHook(block); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue