func (i *Noops) broadcastConsensusMsg(msg *pb.Message) error { t := &pb.Transaction{} if err := proto.Unmarshal(msg.Payload, t); err != nil { return fmt.Errorf("Error unmarshalling payload of received Message:%s.", msg.Type) } // Change the msg type to consensus and broadcast to the network so that // other validators may execute the transaction msg.Type = pb.Message_CONSENSUS if logger.IsEnabledFor(logging.DEBUG) { logger.Debugf("Broadcasting %s", msg.Type) } txs := &pb.TransactionBlock{Transactions: []*pb.Transaction{t}} payload, err := proto.Marshal(txs) if err != nil { return err } msg.Payload = payload if errs := i.stack.Broadcast(msg, pb.PeerEndpoint_VALIDATOR); nil != errs { return fmt.Errorf("Failed to broadcast with errors: %v", errs) } return nil }