def _get_const_validator(self): # update coming soon TODO trie_key = get_trie_key(Lookup.constant_rep()) validators = self._trie.get(trie_key) list_validators = [] for rep in validators: ex = extract_values(rep, REP_DICT) rep_obj = prepare_rep(node_id=ex.node_id.encode(), account=ex.account.encode(), delegate=ex.delegated) list_validators.append(rep_obj) return list_validators
def _set_const_validator(self, address, rep_id): # update coming soon TODO trie_key = get_trie_key(Lookup.constant_rep()) rep = prepare_rep(node_id=rep_id, account=address, delegate=self.get_delegated_balance(address)) try: qualify = self.get_const_validator_list() qualify.append(rep.to_dict()) self._trie.put(trie_key, qualify) except KeyError: self._trie.put(trie_key, [rep.to_dict()])
def _get_const_validator_list(self): trie_key = get_trie_key(Lookup.constant_rep()) reps = self._trie.get(trie_key) return reps