From 4c3bab6d963b389af955fe0447af7c4fd45ca4be Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 11 Aug 2022 20:26:19 +0100 Subject: [PATCH] Simplify is_first_relay --- modules/helpers.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/helpers.py b/modules/helpers.py index 63534ed..cd0c510 100644 --- a/modules/helpers.py +++ b/modules/helpers.py @@ -29,9 +29,7 @@ def is_first_relay(net, num): :param num: number or relay :return: True if we are the first relay, False otherwise """ - cur_relay = 0 - max_relay = len(main.network[net].relays.keys()) - while cur_relay > max_relay: - name = net + str(cur_relay) - if name in main.IRCPool.keys(): - return cur_relay == num + first_relay = get_first_relay(net) + if not first_relay: + return False + return first_relay.num == num