mirror of
https://github.com/arnaucube/go-ethereum.git
synced 2026-02-28 05:56:45 +01:00
test for invalid rlp encoding of block in BlocksMsg
- rename Validate -> ValidateFields not to confure consensus block validation - add nil transaction and nil uncle header validation - remove bigint field checks: rlp already decodes *big.Int to big.NewInt(0) - add test for nil header, nil transaction
This commit is contained in:
@@ -268,6 +268,9 @@ func (self *ethProtocol) handle() error {
|
||||
return self.protoError(ErrDecode, "msg %v: %v", msg, err)
|
||||
}
|
||||
}
|
||||
if err := block.ValidateFields(); err != nil {
|
||||
return self.protoError(ErrDecode, "block validation %v: %v", msg, err)
|
||||
}
|
||||
self.blockPool.AddBlock(&block, self.id)
|
||||
}
|
||||
|
||||
@@ -276,7 +279,7 @@ func (self *ethProtocol) handle() error {
|
||||
if err := msg.Decode(&request); err != nil {
|
||||
return self.protoError(ErrDecode, "%v: %v", msg, err)
|
||||
}
|
||||
if err := request.Block.Validate(); err != nil {
|
||||
if err := request.Block.ValidateFields(); err != nil {
|
||||
return self.protoError(ErrDecode, "block validation %v: %v", msg, err)
|
||||
}
|
||||
hash := request.Block.Hash()
|
||||
|
||||
Reference in New Issue
Block a user