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