|
|
@ -58,23 +58,19 @@ class RPCNodeCheckTask(FeatherTask):
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
# Filter out nodes affected by < v0.17.1.3 sybil attack
|
|
|
|
# Filter out nodes affected by < v0.17.1.3 sybil attack
|
|
|
|
data = list(map(lambda node: node if node['target_height'] <= node['height']
|
|
|
|
data = list(map(lambda _node: _node if _node['target_height'] <= _node['height']
|
|
|
|
else self._bad_node(**node), data))
|
|
|
|
else self._bad_node(**_node), data))
|
|
|
|
|
|
|
|
|
|
|
|
allowed_offset = 3
|
|
|
|
allowed_offset = 3
|
|
|
|
valid_heights = []
|
|
|
|
valid_heights = []
|
|
|
|
current_blockheight = heights.get(network_type_coin, 0)
|
|
|
|
# current_blockheight = heights.get(network_type_coin, 0)
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(current_blockheight, int) and current_blockheight > 0:
|
|
|
|
# popularity contest
|
|
|
|
# blockheight from cache has precedence
|
|
|
|
common_height = popularity_contest([z['height'] for z in data])
|
|
|
|
valid_heights = range(current_blockheight, current_blockheight - allowed_offset, -1)
|
|
|
|
valid_heights = range(common_height, common_height - allowed_offset, -1)
|
|
|
|
else:
|
|
|
|
|
|
|
|
# popularity contest
|
|
|
|
data = list(map(lambda _node: _node if _node['height'] in valid_heights
|
|
|
|
common_height = popularity_contest([z['height'] for z in data])
|
|
|
|
else self._bad_node(**_node), data))
|
|
|
|
valid_heights = range(common_height, common_height - allowed_offset, -1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data = list(map(lambda node: node if node['height'] in valid_heights
|
|
|
|
|
|
|
|
else self._bad_node(**node), data))
|
|
|
|
|
|
|
|
nodes += data
|
|
|
|
nodes += data
|
|
|
|
return nodes
|
|
|
|
return nodes
|
|
|
|
|
|
|
|
|
|
|
|