예제 #1
0
     voter_acc = Account(vote["voter"], steem_instance=stm)
     if voter_acc.get_rc_manabar()["current_mana"] / 1e9 < 0.1:
         print("%s has not sufficient RC" % vote["voter"])
         last_voter = vote["voter"]
         continue
     
     if vote["retry_count"] >= 5:
         broadcastVoteTrx.update_processed(vote["voter"], vote["authorperm"], None, False, True)
         continue
     if vote["expiration"] is not None and vote["expiration"] < datetime.utcnow():
         continue
     if vote["weight"] < 0.01:
         continue
     try:
         print("voter %s votes %s" % (vote["voter"], vote["authorperm"]))
         stm.vote(vote["weight"], vote["authorperm"], vote["voter"])
     except Exception as e:
         print("Vote failed: %s" % str(e))
     last_voter = vote["voter"]
     broadcastVoteTrx.update({"voter": vote["voter"], "authorperm": vote["authorperm"], "retry_count": vote["retry_count"] + 1})
 
 print("Start apply new votes")
 vote_count = 0
 delete_pending_votes = []
 for pending_vote in pendingVotesTrx.get_command_list_timed():
     settings = None
     # print("time vote %.2f s - %d votes" % (time.time() - start_prep_time, vote_count))
     if (pending_vote["vote_weight"] is None or pending_vote["vote_weight"] <= 0) and (pending_vote["vote_sbd"] is None or float(pending_vote["vote_sbd"]) <= 0):
         voter_acc = Account(pending_vote["voter"], steem_instance=stm)
         failedVoteLogTrx.add({"authorperm": pending_vote["authorperm"], "voter": pending_vote["voter"], "error": "vote_weight was set to zero. (%s %% and %s $)" % (pending_vote["vote_weight"], pending_vote["vote_sbd"]),
                               "timestamp": datetime.utcnow(), "vote_weight": pending_vote["vote_weight"], "vote_delay_min": pending_vote["vote_delay_min"],
예제 #2
0


        
        voter_this_round[vote["voter"]] = datetime.utcnow()
        if True:
            vote_ops.append({"weight": vote["weight"], "authorperm": vote["authorperm"], "voter": vote["voter"], "retry_count": vote["retry_count"],
                             "voted_after_min": age_min, "vote_delay_min": vote["vote_delay_min"]})
            vote_count += 1
        else:
            try:
                if vote["trail_vote"]:
                    print("trail voter %s votes %s" % (vote["voter"], vote["authorperm"]))
                else:
                    print("voter %s votes %s after %.2f min (%.2f min)" % (vote["voter"], vote["authorperm"], age_min, vote["vote_delay_min"]))
                reply_message = stm.vote(vote["weight"], vote["authorperm"], vote["voter"])
                vote_count += 1
                expiration = formatTimeString(reply_message["expiration"]).replace(tzinfo=None)
                
            except Exception as e:
                expiration = datetime.utcnow()
                print("Vote failed: %s" % str(e))
            
            broadcastVoteTrx.update({"voter": vote["voter"], "authorperm": vote["authorperm"], "retry_count": vote["retry_count"] + 1,
                                     "voted_after_min": age_min, "expiration": expiration})                
        last_voter = vote["voter"]
            
    print("Building vote list: %d - %.2f s" % (len(vote_ops), time.time() - start_prep_time))
    if len(vote_ops) > 0:
        tx = TransactionBuilder(steem_instance=stm)
    else: