Defending Against Malicious Behaviors in Federated Learning with Blockchain