Skip to content
Snippets Groups Projects
Commit 02e6f28f authored by inso's avatar inso
Browse files

Fix Identities find problem

parent a285f13f
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,7 @@ class IdentitiesRegistry: ...@@ -49,7 +49,7 @@ class IdentitiesRegistry:
def lookup(): def lookup():
nonlocal identity nonlocal identity
lookup_tries = 0 lookup_tries = 0
while lookup_tries < 3: while lookup_tries < 3 and identity.local_state == LocalState.NOT_FOUND:
try: try:
data = yield from community.bma_access.simple_request(bma.wot.Lookup, data = yield from community.bma_access.simple_request(bma.wot.Lookup,
req_args={'search': pubkey}) req_args={'search': pubkey})
...@@ -81,13 +81,12 @@ class IdentitiesRegistry: ...@@ -81,13 +81,12 @@ class IdentitiesRegistry:
identity = Identity.empty(pubkey) identity = Identity.empty(pubkey)
self._instances[pubkey] = identity self._instances[pubkey] = identity
tries = 0 tries = 0
while tries < 3: while tries < 3 and identity.local_state == LocalState.NOT_FOUND:
try: try:
data = yield from community.bma_access.simple_request(bma.wot.CertifiersOf, req_args={'search': pubkey}) data = yield from community.bma_access.simple_request(bma.wot.CertifiersOf, req_args={'search': pubkey})
identity.uid = data['uid'] identity.uid = data['uid']
identity.local_state = LocalState.PARTIAL identity.local_state = LocalState.PARTIAL
identity.blockchain_state = BlockchainState.VALIDATED identity.blockchain_state = BlockchainState.VALIDATED
return identity
except ValueError as e: except ValueError as e:
if '404' in str(e) or '400' in str(e): if '404' in str(e) or '400' in str(e):
yield from lookup() yield from lookup()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment