Skip to content
Snippets Groups Projects
Commit 8183ce5d authored by inso's avatar inso
Browse files

Fixing critical bug in community cache

- Wrong values indexed
- Circular reference
parent b2674ef9
Branches
Tags
No related merge requests found
...@@ -80,9 +80,9 @@ class Cache(): ...@@ -80,9 +80,9 @@ class Cache():
''' '''
cache_key = (str(request), cache_key = (str(request),
str(tuple(frozenset(sorted(req_args.keys())))), str(tuple(frozenset(sorted(req_args.keys())))),
str(tuple(frozenset(sorted(req_args.items())))), str(tuple(frozenset(sorted(req_args.values())))),
str(tuple(frozenset(sorted(get_args.keys())))), str(tuple(frozenset(sorted(get_args.keys())))),
str(tuple(frozenset(sorted(get_args.items()))))) str(tuple(frozenset(sorted(get_args.values())))))
if cache_key not in self.data.keys(): if cache_key not in self.data.keys():
result = self.community.request(request, req_args, get_args, result = self.community.request(request, req_args, get_args,
......
...@@ -117,12 +117,13 @@ class Person(object): ...@@ -117,12 +117,13 @@ class Person(object):
for result in data['results']: for result in data['results']:
if result["pubkey"] == pubkey: if result["pubkey"] == pubkey:
uids = result['uids'] uids = result['uids']
for uid in uids: person_uid = ""
if uid["meta"]["timestamp"] > timestamp: for uid_data in uids:
timestamp = uid["meta"]["timestamp"] if uid_data["meta"]["timestamp"] > timestamp:
uid = uid["uid"] timestamp = uid_data["meta"]["timestamp"]
person_uid = uid_data["uid"]
person = cls(uid, pubkey, {}) person = cls(person_uid, pubkey, {})
Person._instances[pubkey] = person Person._instances[pubkey] = person
logging.debug("{0}".format(Person._instances.keys())) logging.debug("{0}".format(Person._instances.keys()))
return person return person
...@@ -299,10 +300,10 @@ class Person(object): ...@@ -299,10 +300,10 @@ class Person(object):
for result in data['results']: for result in data['results']:
if result["pubkey"] == self.pubkey: if result["pubkey"] == self.pubkey:
for uid in result['uids']: for uid_data in result['uids']:
for certifier in uid['others']: for certifier in uid_data['others']:
# add a certifier # add a certifier
certifier['uid'] = uid certifier['uid'] = uid_data['uid']
certifier['cert_time'] = dict() certifier['cert_time'] = dict()
certifier['cert_time']['medianTime'] = community.get_block(certifier['meta']['block_number']).mediantime certifier['cert_time']['medianTime'] = community.get_block(certifier['meta']['block_number']).mediantime
certifiers.append(certifier) certifiers.append(certifier)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment