Skip to content

Commit

Permalink
correct something
Browse files Browse the repository at this point in the history
  • Loading branch information
eclipsevortex committed Apr 25, 2024
1 parent 5652cde commit b6fb3d4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions subnet/validator/miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,17 @@ async def remove_miner(self, uid: int, hotkey: str):
"""
Remove a miner that is not available anymore
"""
miners = [miner for miner in self.miners if miner.uid != uid]
if len(miners) >= len(self.miners):
return False

# Remove the statistics
await remove_hotkey_stastitics(hotkey, self.database)

# Remove the miner
self.miners = [miner for miner in self.miners if miner.uid != uid]
self.miners = miners

return True


async def resync_miners(self):
Expand All @@ -168,8 +174,9 @@ async def resync_miners(self):
self.metagraph, uid, self.config.neuron.vpermit_tao_limit
)
if not is_available:
await remove_miner(self, uid, hotkey)
bt.logging.success(f"[{uid}] Miner {hotkey} has been removed from the list")
removed = await remove_miner(self, uid, hotkey)
if removed:
bt.logging.success(f"[{uid}] Miner {hotkey} has been removed from the list")
continue

miner: Miner = next((miner for miner in self.miners if miner.uid == uid), None)
Expand Down

0 comments on commit b6fb3d4

Please sign in to comment.