From e1e4af2e7b41ac0a6bdddaf3cd47cb1fff7898b6 Mon Sep 17 00:00:00 2001
From: vtexier <vit@free.fr>
Date: Tue, 31 Mar 2020 11:18:54 +0200
Subject: [PATCH] [enh] fix current_buid declared twice in processors/nodes.py

---
 src/sakia/data/processors/nodes.py | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/sakia/data/processors/nodes.py b/src/sakia/data/processors/nodes.py
index 789cd0e5..e865084b 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
-- 
GitLab