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
56a7a8e6
Commit
56a7a8e6
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Check sync between nodes ONLINE or DESYNCED
parent
b3e3755a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cutecoin/core/net/network.py
+3
-3
3 additions, 3 deletions
src/cutecoin/core/net/network.py
with
3 additions
and
3 deletions
src/cutecoin/core/net/network.py
+
3
−
3
View file @
56a7a8e6
...
@@ -198,18 +198,18 @@ class Network(QObject):
...
@@ -198,18 +198,18 @@ class Network(QObject):
4 : The biggest number or timestamp
4 : The biggest number or timestamp
"""
"""
# rule number 1 : block of the majority
# rule number 1 : block of the majority
blocks
=
[
n
.
block
[
'
hash
'
]
for
n
in
self
.
nodes
if
n
.
block
]
blocks
=
[
n
.
block
[
'
hash
'
]
for
n
in
self
.
online_
nodes
if
n
.
block
]
blocks_occurences
=
Counter
(
blocks
)
blocks_occurences
=
Counter
(
blocks
)
blocks_by_occurences
=
{}
blocks_by_occurences
=
{}
for
key
,
value
in
blocks_occurences
.
items
():
for
key
,
value
in
blocks_occurences
.
items
():
the_block
=
[
n
.
block
for
n
in
self
.
nodes
if
n
.
block
and
n
.
block
[
'
hash
'
]
==
key
][
0
]
the_block
=
[
n
.
block
for
n
in
self
.
online_
nodes
if
n
.
block
and
n
.
block
[
'
hash
'
]
==
key
][
0
]
if
value
not
in
blocks_by_occurences
:
if
value
not
in
blocks_by_occurences
:
blocks_by_occurences
[
value
]
=
[
the_block
]
blocks_by_occurences
[
value
]
=
[
the_block
]
else
:
else
:
blocks_by_occurences
[
value
].
append
(
the_block
)
blocks_by_occurences
[
value
].
append
(
the_block
)
if
len
(
blocks_by_occurences
)
==
0
:
if
len
(
blocks_by_occurences
)
==
0
:
for
n
in
[
n
for
n
in
self
.
_nodes
if
n
.
state
in
(
Node
.
ONLINE
,
Node
.
DESYNCED
)]:
for
n
in
[
n
for
n
in
self
.
online
_nodes
if
n
.
state
in
(
Node
.
ONLINE
,
Node
.
DESYNCED
)]:
n
.
state
=
Node
.
ONLINE
n
.
state
=
Node
.
ONLINE
return
return
...
...
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