From 56a7a8e677da89536dce22bb6cd39107c7d62ea7 Mon Sep 17 00:00:00 2001 From: Insoleet <insomniak.fr@gmail.com> Date: Fri, 18 Sep 2015 16:56:58 +0200 Subject: [PATCH] Check sync between nodes ONLINE or DESYNCED --- src/cutecoin/core/net/network.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cutecoin/core/net/network.py b/src/cutecoin/core/net/network.py index e600aab4..2e3a0d17 100644 --- a/src/cutecoin/core/net/network.py +++ b/src/cutecoin/core/net/network.py @@ -198,18 +198,18 @@ class Network(QObject): 4 : The biggest number or timestamp """ # 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_by_occurences = {} 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: blocks_by_occurences[value] = [the_block] else: blocks_by_occurences[value].append(the_block) 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 return -- GitLab