Skip to content

Commit 0072ec5

Browse files
authored
Merge pull request #2937 from opentensor/fix/roman/subnet
Improve subnet method logic
2 parents e46bb90 + 7010965 commit 0072ec5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

bittensor/core/async_subtensor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,7 @@ async def subnet(
30913091

30923092
if isinstance(decoded := query.decode(), dict):
30933093
return DynamicInfo.from_dict(decoded)
3094+
return None
30943095

30953096
async def subnet_exists(
30963097
self,

bittensor/core/subtensor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,8 +2399,10 @@ def subnet(self, netuid: int, block: Optional[int] = None) -> Optional[DynamicIn
23992399
params=[netuid],
24002400
block_hash=block_hash,
24012401
)
2402-
subnet = DynamicInfo.from_dict(query.decode()) # type: ignore
2403-
return subnet
2402+
2403+
if isinstance(decoded := query.decode(), dict):
2404+
return DynamicInfo.from_dict(decoded)
2405+
return None
24042406

24052407
def subnet_exists(self, netuid: int, block: Optional[int] = None) -> bool:
24062408
"""

0 commit comments

Comments
 (0)