Skip to content

Commit

Permalink
add uid check before processing
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-opentensor committed Dec 24, 2024
1 parent 832aff3 commit 3497cd6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 9 additions & 3 deletions bittensor/core/async_subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1599,9 +1599,15 @@ async def set_weights(
"""
retries = 0
success = False
uid = await self.get_uid_for_hotkey_on_subnet(
wallet.hotkey.ss58_address, netuid
)
if (
uid := await self.get_uid_for_hotkey_on_subnet(
wallet.hotkey.ss58_address, netuid
)
) is None:
return (
False,
f"Hotkey {wallet.hotkey.ss58_address} not registered in subnet {netuid}",
)

if (await self.commit_reveal_enabled(netuid=netuid)) is True:
# go with `commit reveal v3` extrinsic
Expand Down
8 changes: 7 additions & 1 deletion bittensor/core/subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,13 @@ def set_weights(
"""
retries = 0
success = False
uid = self.get_uid_for_hotkey_on_subnet(wallet.hotkey.ss58_address, netuid)
if (
uid := self.get_uid_for_hotkey_on_subnet(wallet.hotkey.ss58_address, netuid)
) is None:
return (
False,
f"Hotkey {wallet.hotkey.ss58_address} not registered in subnet {netuid}",
)

if self.commit_reveal_enabled(netuid=netuid) is True:
# go with `commit reveal v3` extrinsic
Expand Down

0 comments on commit 3497cd6

Please sign in to comment.