Exemplo n.º 1
0
        def iter_voters():
            """
            For each event round in range (max_c; max_r]
            get witness from db
            (order is from earlier rounds to later)

            :return: witnesses in format (round, witness hash)
            :rtype: generator
            """

            self.logger.debug("MAX_C value = %s", str(max_c))
            for _r in range(max_c + 1, max_r + 1):
                self.logger.debug("X value = %s", str(_r))
                witness = Prisma().db.get_witness(_r)
                for w in witness.values():
                    yield _r, w
Exemplo n.º 2
0
        def iter_undetermined(r_):
            """
            For each round in range (max_c; r)
            get from db witnesses than add
            witness to result list if it is not famous

            :param r_: current iteration round
            :type r_: int
            :return: witnesses in format (round, witness hash)
            :rtype: generator
            """
            for r in range(max_c, r_):
                self.logger.debug("Start cycle with r = %s", str(r))
                if not Prisma().db.check_consensus(r):
                    self.logger.debug("r is not in consensus")
                    witness = Prisma().db.get_witness(r)
                    self.logger.debug("self.node.witnesses[r] %s",
                                      str(witness))
                    for w in witness.values():
                        self.logger.debug("Start cycle with w = %s", str(w))
                        if not Prisma().db.check_famous(w):
                            self.logger.debug("w is not in famous")
                            yield r, w