Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion consensus/XDPoS/engines/engine_v2/verifyHeader.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func (x *XDPoS_v2) verifyHeader(chain consensus.ChainReader, header *types.Heade
}

if len(header.Validator) == 0 {
return consensus.ErrNoValidatorSignature
// This should never happen, if it does, then it means the peer is sending us invalid data.
return consensus.ErrNoValidatorSignatureV2
}

if fullVerify {
Expand Down
2 changes: 2 additions & 0 deletions consensus/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ var (

ErrNoValidatorSignature = errors.New("no validator in header")

ErrNoValidatorSignatureV2 = errors.New("no validator in v2 header")

ErrNotReadyToPropose = errors.New("not ready to propose, QC is not ready")

ErrNotReadyToMine = errors.New("Not ready to mine, it's not your turn")
Expand Down
2 changes: 1 addition & 1 deletion consensus/tests/engine_v2_tests/verify_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestShouldVerifyBlock(t *testing.T) {
noValidatorBlock := blockchain.GetBlockByNumber(902).Header()
noValidatorBlock.Validator = []byte{}
err = adaptor.VerifyHeader(blockchain, noValidatorBlock, true)
assert.Equal(t, consensus.ErrNoValidatorSignature, err)
assert.Equal(t, consensus.ErrNoValidatorSignatureV2, err)

blockFromFuture := blockchain.GetBlockByNumber(902).Header()
blockFromFuture.Time = big.NewInt(time.Now().Unix() + 10000)
Expand Down