def msg_propose_accept(self, conn, msg):
        """MSG_PROPOSE_ACCEPT is handled only if it belongs to an outstanding MSG_PREPARE,
        otherwise it is discarded.
        When MSG_PROPOSE_ACCEPT is received, the corresponding ResponseCollector is retrieved
        and its state is updated accordingly.

        State Updates:
        - increment receivedcount
        - if receivedcount is greater than the quorum size, PROPOSE STAGE is successful.
        -- remove the old ResponseCollector from the outstanding prepare set
        -- create MSG_PERFORM: message carries the chosen commandnumber and proposal.
        -- send MSG_PERFORM to all Replicas and Leaders
        -- execute the command
        """
        if msg.commandnumber in self.outstandingproposes:
            prc = self.outstandingproposes[msg.commandnumber]
            if msg.inresponseto == prc.ballotnumber:
                prc.receivedcount += 1
                prc.receivedfrom.add(conn.peerid)
                if self.debug: self.logger.write("Paxos State",
                                                 "got an accept for proposal ballotno %s "\
                                                  "commandno %s proposal %s making %d/%d accepts" % \
                                                  (prc.ballotnumber, prc.commandnumber,
                                                   prc.proposal, prc.receivedcount, prc.ntotal))
                if prc.receivedcount >= prc.nquorum:
                    if self.debug: self.logger.write("Paxos State", "Agreed on %s" % str(prc.proposal))
                    # take this response collector out of the outstanding propose set
                    self.add_to_proposals(prc.commandnumber, prc.proposal)
                    # delete outstanding messages that caller does not need to check for anymore
                    del self.outstandingproposes[msg.commandnumber]

                    # now we can perform this action on the replicas
                    performmessage = create_message(MSG_PERFORM, self.me,
                                                    {FLD_COMMANDNUMBER: prc.commandnumber,
                                                     FLD_PROPOSAL: prc.proposal,
                                                     FLD_SERVERBATCH: isinstance(prc.proposal,
                                                                                 ProposalServerBatch),
                                                     FLD_CLIENTBATCH: isinstance(prc.proposal,
                                                                                 ProposalClientBatch),
                                                     FLD_DECISIONBALLOTNUMBER: prc.ballotnumber})

                    if self.debug: self.logger.write("Paxos State", "Sending PERFORM!")
                    if len(self.replicas) > 0:
                        self.send(performmessage, group=self.replicas)
                    self.perform(parse_message(performmessage), designated=True)
            if self.debug: self.logger.write("State", "returning from msg_propose_accept")
dataset/ETHPy150Open denizalti/concoord/concoord/replica.py/Replica.msg_propose_accept/original