engine_v2: reject wrong signature earlier, close XFN-29 (#1661)

This commit is contained in:
Daniel Liu 2025-11-03 15:21:56 +08:00 committed by benjamin202410
parent ffe56f54c4
commit 22e8b476d9

View file

@ -40,6 +40,8 @@ func (x *XDPoS_v2) verifyHeader(chain consensus.ChainReader, header *types.Heade
if len(header.Validator) == 0 { if len(header.Validator) == 0 {
// This should never happen, if it does, then it means the peer is sending us invalid data. // This should never happen, if it does, then it means the peer is sending us invalid data.
return consensus.ErrNoValidatorSignatureV2 return consensus.ErrNoValidatorSignatureV2
} else if len(header.Validator) != 65 {
return fmt.Errorf("invalid validator signature length %d, want 65", len(header.Validator))
} }
if fullVerify { if fullVerify {