Ejemplo n.º 1
0
    def supply_sufficient_fee_for_members(self):
        # head alliance must be issuer 1
        if env.host != env.roledefs['issuer'][0]:
            return

        issuer = Issuer(env.host, self.applied_colors[1], 1)
        for color, addresses in self.applied_members.iteritems():
            for address in addresses:
                issuer.activate(address, config.MAX_TRANSACTION_NUM_ALLOWED_PER_MEMBER_PER_COLOR)
Ejemplo n.º 2
0
    def supply_sufficient_fee_for_members(self):
        # head alliance must be issuer 1
        if env.host != env.roledefs['issuer'][0]:
            return

        issuer = Issuer(env.host, self.applied_colors[1], 1)
        for color, addresses in self.applied_members.iteritems():
            for address in addresses:
                issuer.activate(address, config.MAX_TRANSACTION_NUM_ALLOWED_PER_MEMBER_PER_COLOR)
Ejemplo n.º 3
0
    def random_apply_member(self):
        result = {}

        role = BaseRole(env.host)
        licenseinfo = role.getlicenseinfo()
        for color, info in licenseinfo.iteritems():
            if int(color) == 1:
                # for the use of fee
                continue

            members = []
            issuer = Issuer(env.host, info['address'], color)
            for idx in xrange(config.MAX_NUM_MEMBERS_PER_ISSUER):
                member_address = self._random_choose_an_address('others')
                if member_address in members:
                    continue
                issuer.activate(member_address, config.INITIAL_AMOUNT_PER_ISSUER / config.MAX_NUM_MEMBERS_PER_ISSUER)
                members.append(member_address)

            result[color] = members

        return result
Ejemplo n.º 4
0
    def random_apply_member(self):
        result = {}

        role = BaseRole(env.host)
        licenseinfo = role.getlicenseinfo()
        for color, info in licenseinfo.iteritems():
            if int(color) == 1:
                # for the use of fee
                continue

            members = []
            issuer = Issuer(env.host, info['address'], color)
            for idx in xrange(config.MAX_NUM_MEMBERS_PER_ISSUER):
                member_address = self._random_choose_an_address('others')
                if member_address in members:
                    continue
                issuer.activate(member_address, config.INITIAL_AMOUNT_PER_ISSUER / config.MAX_NUM_MEMBERS_PER_ISSUER)
                members.append(member_address)

            result[color] = members

        return result