diff --git a/src/sakia/data/processors/nodes.py b/src/sakia/data/processors/nodes.py index 789cd0e53fe62e6d39c2bfd6fc4a932e85876efd..e865084bed2b1bf69a1d151b359c8fa965539d16 100644 --- a/src/sakia/data/processors/nodes.py +++ b/src/sakia/data/processors/nodes.py @@ -1,7 +1,7 @@ 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