Exemple #1
0
    def get_gobject_votes(self, object_hash):
        import dashlib
        if not self.gobject_votes.get(object_hash):

            cmd = ['gobject', 'getcurrentvotes', object_hash]
            raw_votes = self.rpc_command(*cmd)
            self.gobject_votes[object_hash] = dashlib.parse_raw_votes(raw_votes)

        return self.gobject_votes[object_hash]
Exemple #2
0
def get_ballot(proposal_hash):
    vote_info = {}

    try:
        vote_data = json.loads(
            run_dash_cli_command('gobject getvotes %s' % proposal_hash))
        vote_info['votes'] = dashlib.parse_raw_votes(vote_data)
        vote_info['hash'] = proposal_hash

        return vote_info

    except Exception as e:
        print(e)
        return ''
Exemple #3
0
    def get_my_gobject_votes(self, object_hash):
        import dashlib
        if not self.gobject_votes.get(object_hash):
            my_vin = self.get_current_masternode_vin()
            # if we can't get MN vin from output of `masternode status`,
            # return an empty list
            if not my_vin:
                return []

            (txid, vout_index) = my_vin.split('-')

            cmd = ['gobject', 'getcurrentvotes', object_hash, txid, vout_index]
            raw_votes = self.rpc_command(*cmd)
            self.gobject_votes[object_hash] = dashlib.parse_raw_votes(raw_votes)

        return self.gobject_votes[object_hash]