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
e1e4af2e
Commit
e1e4af2e
authored
5 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
[enh] fix current_buid declared twice in processors/nodes.py
parent
81515f5e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!778
Release 0.51.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sakia/data/processors/nodes.py
+7
-12
7 additions, 12 deletions
src/sakia/data/processors/nodes.py
with
7 additions
and
12 deletions
src/sakia/data/processors/nodes.py
+
7
−
12
View file @
e1e4af2e
import
attr
import
attr
import
sqlite3
import
sqlite3
from
duniterpy.documents.ws2p.heads
import
HeadV1
,
HeadV2
from
duniterpy.documents.ws2p.heads
import
HeadV2
from
sakia.constants
import
ROOT_SERVERS
from
sakia.constants
import
ROOT_SERVERS
from
..entities
import
Node
from
..entities
import
Node
...
@@ -33,6 +33,10 @@ class NodesProcessor:
...
@@ -33,6 +33,10 @@ class NodesProcessor:
def
current_buid
(
self
,
currency
):
def
current_buid
(
self
,
currency
):
"""
"""
Get current buid
Get current buid
Get the latest block considered valid
It is the most frequent last block of every known nodes
:param str currency:
:param str currency:
"""
"""
current_buid
=
self
.
_repo
.
current_buid
(
currency
=
currency
)
current_buid
=
self
.
_repo
.
current_buid
(
currency
=
currency
)
...
@@ -104,6 +108,8 @@ class NodesProcessor:
...
@@ -104,6 +108,8 @@ class NodesProcessor:
def
unknown_node
(
self
,
currency
,
pubkey
):
def
unknown_node
(
self
,
currency
,
pubkey
):
"""
"""
Search for pubkey in the repository.
Search for pubkey in the repository.
:param str currency: Name of currency
:param str pubkey: the pubkey to lookup
:param str pubkey: the pubkey to lookup
"""
"""
other_node
=
self
.
_repo
.
get_one
(
currency
=
currency
,
pubkey
=
pubkey
)
other_node
=
self
.
_repo
.
get_one
(
currency
=
currency
,
pubkey
=
pubkey
)
...
@@ -121,17 +127,6 @@ class NodesProcessor:
...
@@ -121,17 +127,6 @@ class NodesProcessor:
"""
"""
return
self
.
_repo
.
get_all
(
currency
=
currency
,
root
=
True
)
return
self
.
_repo
.
get_all
(
currency
=
currency
,
root
=
True
)
def
current_buid
(
self
,
currency
):
"""
Get the latest block considered valid
It is the most frequent last block of every known nodes
"""
blocks_uids
=
[
n
.
current_buid
for
n
in
self
.
synced_nodes
(
currency
)]
if
len
(
blocks_uids
)
>
0
:
return
blocks_uids
[
0
]
else
:
return
BlockUID
.
empty
()
def
quality
(
self
,
currency
):
def
quality
(
self
,
currency
):
"""
"""
Get a ratio of the synced nodes vs the rest
Get a ratio of the synced nodes vs the rest
...
...
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