Skip to content
Snippets Groups Projects
Commit e1e4af2e authored by Vincent Texier's avatar Vincent Texier
Browse files

[enh] fix current_buid declared twice in processors/nodes.py

parent 81515f5e
Branches
Tags
1 merge request!778Release 0.51.0
import attr
import sqlite3
from duniterpy.documents.ws2p.heads import HeadV1, HeadV2
from duniterpy.documents.ws2p.heads import HeadV2
from sakia.constants import ROOT_SERVERS
from ..entities import Node
......@@ -33,6 +33,10 @@ class NodesProcessor:
def current_buid(self, currency):
"""
Get current buid
Get the latest block considered valid
It is the most frequent last block of every known nodes
:param str currency:
"""
current_buid = self._repo.current_buid(currency=currency)
......@@ -104,6 +108,8 @@ class NodesProcessor:
def unknown_node(self, currency, pubkey):
"""
Search for pubkey in the repository.
:param str currency: Name of currency
:param str pubkey: the pubkey to lookup
"""
other_node = self._repo.get_one(currency=currency, pubkey=pubkey)
......@@ -121,17 +127,6 @@ class NodesProcessor:
"""
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):
"""
Get a ratio of the synced nodes vs the rest
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment