示例#1
0
                for vote in a:
                    author = vote["author"]
                    if author in member_data:
                        member_data[author]["rewarded_rshares"] += int(
                            vote["rshares"])
                        member_data[author]["balance_rshares"] -= int(
                            vote["rshares"])

        if True:
            b = Blockchain(steem_instance=stm)
            wallet = Wallet(steem_instance=stm)
            accountTrx = {}
            for acc_name in accounts:
                print(acc_name)
                db = dataset.connect(databaseConnector)
                accountTrx[acc_name] = AccountTrx(db, acc_name)

                comments_transfer = []
                comments = []
                ops = accountTrx[acc_name].get_all(op_types=["transfer"])
                cnt = 0
                for o in ops:
                    cnt += 1
                    if cnt % 10000 == 0:
                        print("%d/%d" % (cnt, len(ops)))
                    op = json.loads(o["op_dict"])
                    if op["memo"] == "":
                        continue
                    try:
                        c = Comment(op["memo"], steem_instance=stm)
                    except:
示例#2
0
    last_cycle = conf_setup["last_cycle"]
    share_cycle_min = conf_setup["share_cycle_min"]
    sp_share_ratio = conf_setup["sp_share_ratio"]
    rshares_per_cycle = conf_setup["rshares_per_cycle"]
    del_rshares_per_cycle = conf_setup["del_rshares_per_cycle"]
    upvote_multiplier = conf_setup["upvote_multiplier"]
    last_paid_post = conf_setup["last_paid_post"]
    last_paid_comment = conf_setup["last_paid_comment"]
    last_delegation_check = conf_setup["last_delegation_check"]
    minimum_vote_threshold = conf_setup["minimum_vote_threshold"]
    upvote_multiplier_adjusted = conf_setup["upvote_multiplier_adjusted"]

    accountTrx = {}
    for account in accounts:
        if account == "steembasicincome":
            accountTrx["sbi"] = AccountTrx(db, "sbi")
        else:
            accountTrx[account] = AccountTrx(db, account)

    print("sbi_update_curation_rshares: last_cycle: %s - %.2f min" %
          (formatTimeString(last_cycle),
           (datetime.utcnow() - last_cycle).total_seconds() / 60))
    print("last_paid_post: %s - last_paid_comment: %s" %
          (formatTimeString(last_paid_post),
           formatTimeString(last_paid_comment)))

    if (datetime.utcnow() - last_cycle).total_seconds() > 60 * share_cycle_min:

        new_cycle = (datetime.utcnow() -
                     last_cycle).total_seconds() > 60 * share_cycle_min
        current_cycle = last_cycle + timedelta(seconds=60 * share_cycle_min)
    # Update current node list from @fullnodeupdate
    nodes = NodeList()
    try:
        nodes.update_nodes(weights={"hist": 1})
    except:
        print("could not update nodes")
    stm = Steem(node=nodes.get_nodes())
    print(str(stm))
    set_shared_steem_instance(stm)

    blockchain = Blockchain()

    accountTrx = {}
    for account in accounts:
        accountTrx[account] = AccountTrx(db, account)

        if not accountTrx[account].exists_table():
            accountTrx[account].create_table()

    for account_name in accounts:
        account = Account(account_name)
        print("account %s" % account["name"])
        # Go trough all transfer ops
        cnt = 0
        cnt = 0
        ops = accountTrx[account_name].get_all()
        last_op_index = -1
        for op in ops:

            if op["op_acc_index"] - last_op_index != 1: