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
eeb0f8a3
Commit
eeb0f8a3
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix wrong network behaviour when root nodes change identity
parent
9450780a
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cutecoin/core/app.py
+4
-4
4 additions, 4 deletions
src/cutecoin/core/app.py
src/cutecoin/core/net/network.py
+8
-1
8 additions, 1 deletion
src/cutecoin/core/net/network.py
src/cutecoin/core/net/node.py
+5
-7
5 additions, 7 deletions
src/cutecoin/core/net/node.py
with
17 additions
and
12 deletions
src/cutecoin/core/app.py
+
4
−
4
View file @
eeb0f8a3
...
@@ -72,15 +72,15 @@ class Application(QObject):
...
@@ -72,15 +72,15 @@ class Application(QObject):
}
}
self
.
notifications
=
{
'
membership_expire_soon
'
:
self
.
notifications
=
{
'
membership_expire_soon
'
:
(
[
self
.
tr
(
"
Warning : Your membership is expiring soon.
"
),
self
.
tr
(
"
Warning : Your membership is expiring soon.
"
),
0
0
)
,
]
,
'
warning_certifications
'
:
'
warning_certifications
'
:
(
[
self
.
tr
(
"
Warning : Your could miss certifications soon.
"
),
self
.
tr
(
"
Warning : Your could miss certifications soon.
"
),
0
0
)
]
}
}
@classmethod
@classmethod
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/core/net/network.py
+
8
−
1
View file @
eeb0f8a3
...
@@ -98,7 +98,6 @@ class Network(QObject):
...
@@ -98,7 +98,6 @@ class Network(QObject):
node
=
Node
.
from_json
(
currency
,
data
)
node
=
Node
.
from_json
(
currency
,
data
)
nodes
.
append
(
node
)
nodes
.
append
(
node
)
network
=
cls
(
currency
,
nodes
)
network
=
cls
(
currency
,
nodes
)
# We block the signals until loading the nodes cache
return
network
return
network
def
jsonify
(
self
):
def
jsonify
(
self
):
...
@@ -269,6 +268,7 @@ class Network(QObject):
...
@@ -269,6 +268,7 @@ class Network(QObject):
"""
"""
self
.
_nodes
.
append
(
node
)
self
.
_nodes
.
append
(
node
)
node
.
changed
.
connect
(
self
.
handle_change
)
node
.
changed
.
connect
(
self
.
handle_change
)
node
.
identity_changed
.
connect
(
self
.
handle_identity_change
)
node
.
neighbour_found
.
connect
(
self
.
handle_new_node
)
node
.
neighbour_found
.
connect
(
self
.
handle_new_node
)
logging
.
debug
(
"
{:} connected
"
.
format
(
node
.
pubkey
[:
5
]))
logging
.
debug
(
"
{:} connected
"
.
format
(
node
.
pubkey
[:
5
]))
...
@@ -330,6 +330,13 @@ class Network(QObject):
...
@@ -330,6 +330,13 @@ class Network(QObject):
except
InvalidNodeCurrency
as
e
:
except
InvalidNodeCurrency
as
e
:
logging
.
debug
(
str
(
e
))
logging
.
debug
(
str
(
e
))
@pyqtSlot
()
def
handle_identity_change
(
self
):
node
=
self
.
sender
()
if
node
in
self
.
_root_nodes
:
self
.
root_nodes_changed
.
emit
()
self
.
nodes_changed
.
emit
()
@pyqtSlot
()
@pyqtSlot
()
def
handle_change
(
self
):
def
handle_change
(
self
):
node
=
self
.
sender
()
node
=
self
.
sender
()
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/core/net/node.py
+
5
−
7
View file @
eeb0f8a3
...
@@ -36,6 +36,7 @@ class Node(QObject):
...
@@ -36,6 +36,7 @@ class Node(QObject):
CORRUPTED
=
4
CORRUPTED
=
4
changed
=
pyqtSignal
()
changed
=
pyqtSignal
()
identity_changed
=
pyqtSignal
()
neighbour_found
=
pyqtSignal
(
Peer
,
str
)
neighbour_found
=
pyqtSignal
(
Peer
,
str
)
def
__init__
(
self
,
currency
,
endpoints
,
uid
,
pubkey
,
block
,
def
__init__
(
self
,
currency
,
endpoints
,
uid
,
pubkey
,
block
,
...
@@ -345,18 +346,15 @@ class Node(QObject):
...
@@ -345,18 +346,15 @@ class Node(QObject):
node_currency
=
peering_data
[
"
currency
"
]
node_currency
=
peering_data
[
"
currency
"
]
self
.
state
=
Node
.
ONLINE
self
.
state
=
Node
.
ONLINE
change
=
False
if
node_pubkey
!=
self
.
pubkey
:
if
node_pubkey
!=
self
.
pubkey
:
self
.
_pubkey
=
node_pubkey
self
.
_pubkey
=
node_pubkey
change
=
True
self
.
identity_changed
.
emit
()
if
node_currency
!=
self
.
currency
:
if
node_currency
!=
self
.
currency
:
self
.
state
=
Node
.
CORRUPTED
self
.
state
=
Node
.
CORRUPTED
logging
.
debug
(
"
Change : new state corrupted
"
)
logging
.
debug
(
"
Change : new state corrupted
"
)
change
=
True
if
change
:
self
.
changed
.
emit
()
self
.
changed
.
emit
()
except
ValueError
as
e
:
except
ValueError
as
e
:
logging
.
debug
(
"
Error in peering reply : {0}
"
.
format
(
str
(
e
)))
logging
.
debug
(
"
Error in peering reply : {0}
"
.
format
(
str
(
e
)))
self
.
changed
.
emit
()
self
.
changed
.
emit
()
...
@@ -415,13 +413,13 @@ class Node(QObject):
...
@@ -415,13 +413,13 @@ class Node(QObject):
uid
=
uid
[
"
uid
"
]
uid
=
uid
[
"
uid
"
]
if
self
.
_uid
!=
uid
:
if
self
.
_uid
!=
uid
:
self
.
_uid
=
uid
self
.
_uid
=
uid
self
.
changed
.
emit
()
self
.
identity_
changed
.
emit
()
except
ValueError
as
e
:
except
ValueError
as
e
:
if
'
404
'
in
str
(
e
):
if
'
404
'
in
str
(
e
):
logging
.
debug
(
"
UID not found
"
)
logging
.
debug
(
"
UID not found
"
)
else
:
else
:
logging
.
debug
(
"
error in uid reply
"
)
logging
.
debug
(
"
error in uid reply
"
)
self
.
changed
.
emit
()
self
.
identity_
changed
.
emit
()
except
ClientError
:
except
ClientError
:
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
...
...
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