Exemple #1
0
def insert_users(list_of_users):

    for username in list_of_users:

        check_user = migration_users.find_one({"username": username})

        print check_user

        insert_btc_diff(username, check_user['profile'], str(check_user['nmc_address']))
Exemple #2
0
def calculate_old_users_bug():

    counter = 0
    for old_user in old_users.find():

        username = old_user['username']

        new_user = users.find_one({"username": username})

        if new_user is not None:

            btc_address = address_to_new_cryptocurrency(str(old_user['namecoin_address']), 0)
            btc_user = btc_state.find_one({"username": username})

            if btc_user is not None:
                if btc_address == btc_user['btc_address']:
                    print username
                    insert_btc_diff(username, new_user['profile'], str(new_user['namecoin_address']))
                    counter += 1
    print counter
Exemple #3
0
def calculate_diff():

    ban_users = []

    counter = 0

    for check_user in old_users.find():

        username = check_user["username"]
        check_new_user = users.find_one({"username": username})
        check_btc = btc_state.find_one({"username": username})
        check_btc_diff = btc_state_diff.find_one({"username": username})

        if check_btc is None and check_btc_diff is None and check_new_user is None:

            if len(username) == 34 or len(username) == 33:
                continue

            if 'stormtrooper' in username or 'clone' in username:
                continue

            if username in ban_users:
                continue

            namecoind = NamecoindClient()

            try:
                resp = namecoind.name_show('u/' + username)
            except Exception as e:
                print username
                print e
                continue

            if 'code' in resp:
                print "not registered: %s" % username
                continue

            try:
                resp_value = resp['value']

                if 'message' in resp_value:
                    print "reserved: %s" % username
                    continue
            except Exception as e:
                print e

            try:
                current_nmc_address = resp['address']
            except Exception as e:
                print resp
                continue

            if current_nmc_address == check_user['namecoin_address']:
                print "transferred new user: %s" % username
                insert_btc_diff(username, check_user['profile'], str(check_user['namecoin_address']))
            else:
                namecoind = get_namecoind('u/' + username)

                try:
                    resp = namecoind.validateaddress(current_nmc_address)
                except Exception as e:
                    print e
                    continue

                if 'ismine' in resp and resp['ismine'] is True:

                    profile = check_user['profile']
                    if type(profile) is not dict:
                        profile = json.loads(profile)

                    insert_btc_diff(username, profile, str(check_user['namecoin_address']))

                else:
                    print "problem: %s" % username
                    print check_user['namecoin_address']

            print '-' * 5
            counter += 1

    print counter