Ejemplo n.º 1
0
 def doPrepare(self, pp: PrePrepare):
     logger.debug("{} Sending PREPARE {} at {}".format(
         self, (pp.viewNo, pp.ppSeqNo), time.perf_counter()))
     prepare = Prepare(self.instId, pp.viewNo, pp.ppSeqNo, pp.digest,
                       pp.ppTime)
     self.send(prepare, TPCStat.PrepareSent)
     self.addToPrepares(prepare, self.name)
Ejemplo n.º 2
0
 def evilSendPrepare(self, request):
     logger.debug(
         "EVIL: Creating prepare message for request {}".format(request))
     prepare = Prepare(self.instId, request.viewNo, request.ppSeqNo,
                       request.digest, request.ppTime)
     self.addToPrepares(prepare, self.name)
     sendDup(self, prepare, TPCStat.PrepareSent, count)
Ejemplo n.º 3
0
 def evilSendPrepare(self, request):
     digest = "random"
     prepare = Prepare(self.instId, request.viewNo, request.ppSeqNo, digest,
                       request.ppTime)
     logger.debug(
         "EVIL: Creating prepare message for request {}: {}".format(
             request, prepare))
     self.addToPrepares(prepare, self.name)
     self.send(prepare, TPCStat.PrepareSent)
    def sendPrepareFromPrimary(instId):
        primary = getPrimaryReplica(nodeSet, instId)
        viewNo, ppSeqNo = next(iter(primary.sentPrePrepares.keys()))
        prepare = Prepare(instId, viewNo, ppSeqNo, preprepared1.digest,
                          time.time())
        primary.doPrepare(prepare)

        def chk():
            for r in getNonPrimaryReplicas(nodeSet, instId):
                l = len([
                    param for param in getAllArgs(r, r.processPrepare)
                    if param['sender'] == primary.name
                ])
                assert l == 1

        looper.run(eventually(chk))