eth: check propagated block malformation on receiption
This commit is contained in:
		| @@ -687,6 +687,14 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { | ||||
| 		if err := msg.Decode(&request); err != nil { | ||||
| 			return errResp(ErrDecode, "%v: %v", msg, err) | ||||
| 		} | ||||
| 		if hash := types.CalcUncleHash(request.Block.Uncles()); hash != request.Block.UncleHash() { | ||||
| 			log.Warn("Propagated block has invalid uncles", "have", hash, "exp", request.Block.UncleHash()) | ||||
| 			break // TODO(karalabe): return error eventually, but wait a few releases | ||||
| 		} | ||||
| 		if hash := types.DeriveSha(request.Block.Transactions()); hash != request.Block.TxHash() { | ||||
| 			log.Warn("Propagated block has invalid body", "have", hash, "exp", request.Block.TxHash()) | ||||
| 			break // TODO(karalabe): return error eventually, but wait a few releases | ||||
| 		} | ||||
| 		if err := request.sanityCheck(); err != nil { | ||||
| 			return err | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user