Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
a1b28e59
Commit
a1b28e59
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix crash when recursively looking for a key fails
parent
d485af08
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cutecoin/core/graph.py
+9
-9
9 additions, 9 deletions
src/cutecoin/core/graph.py
with
9 additions
and
9 deletions
src/cutecoin/core/graph.py
+
9
−
9
View file @
a1b28e59
...
...
@@ -85,7 +85,7 @@ class Graph(object):
# recursively feed graph searching for account node...
yield
from
self
.
explore_to_find_member
(
to_identity
,
self
.
_graph
[
from_identity
.
pubkey
][
'
connected
'
],
list
())
if
len
(
self
.
_graph
[
from_identity
.
pubkey
][
'
connected
'
])
>
0
:
if
len
(
self
.
_graph
[
from_identity
.
pubkey
][
'
connected
'
])
>
0
and
to_identity
.
pubkey
in
self
.
_graph
:
# calculate path of nodes between identity and to_identity
path
=
yield
from
self
.
find_shortest_path
(
self
.
_graph
[
from_identity
.
pubkey
],
self
.
_graph
[
to_identity
.
pubkey
])
...
...
@@ -105,7 +105,7 @@ class Graph(object):
:param list connected: Optional, default=None, Pubkey list of the connected nodes
around the current scanned node
:param list done: Optional, default=None, List of node already scanned
:return:
:return:
False when the identity is added in the graph
"""
# functions keywords args are persistent... Need to reset it with None trick
connected
=
connected
or
(
list
()
and
(
connected
is
None
))
...
...
@@ -123,23 +123,23 @@ class Graph(object):
self
.
community
)
yield
from
self
.
add_certifier_list
(
certifier_list
,
identity_selected
,
identity
)
if
identity
.
pubkey
in
tuple
(
self
.
_graph
.
keys
()):
return
Fals
e
return
Tru
e
certified_list
=
yield
from
identity_selected
.
unique_valid_certified_by
(
self
.
app
.
identities_registry
,
self
.
community
)
yield
from
self
.
add_certified_list
(
certified_list
,
identity_selected
,
identity
)
if
identity
.
pubkey
in
tuple
(
self
.
_graph
.
keys
()):
return
Fals
e
return
Tru
e
if
node
[
'
id
'
]
not
in
tuple
(
done
):
done
.
append
(
node
[
'
id
'
])
if
len
(
done
)
>=
len
(
self
.
_graph
):
return
Tru
e
result
=
yield
from
self
.
explore_to_find_member
(
identity
,
return
Fals
e
found
=
yield
from
self
.
explore_to_find_member
(
identity
,
self
.
_graph
[
identity_selected
.
pubkey
][
'
connected
'
],
done
)
if
not
result
:
return
Fals
e
if
found
:
return
Tru
e
return
Tru
e
return
Fals
e
@asyncio.coroutine
def
find_shortest_path
(
self
,
start
,
end
,
path
=
None
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment