Simplify is_first_relay

This commit is contained in:
Mark Veidemanis 2022-08-11 20:26:19 +01:00
parent 14eb05722c
commit 4c3bab6d96
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 4 additions and 6 deletions

View File

@ -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