Skip to content

Commit 85c294a

Browse files
committed
Introduce block_hash and reuse_block args for is_hotkey_registered.
1 parent cf5dd72 commit 85c294a

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

bittensor/core/async_subtensor.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,8 @@ async def is_hotkey_registered(
16181618
hotkey_ss58: str,
16191619
netuid: Optional[int] = None,
16201620
block: Optional[int] = None,
1621+
block_hash: Optional[str] = None,
1622+
reuse_block: bool = False,
16211623
) -> bool:
16221624
"""
16231625
Determines whether a given hotkey (public key) is registered in the Bittensor network, either globally across
@@ -1626,10 +1628,14 @@ async def is_hotkey_registered(
16261628
network.
16271629
16281630
Args:
1629-
hotkey_ss58 (str): The SS58 address of the neuron's hotkey.
1630-
netuid (Optional[int]): The unique identifier of the subnet to check the registration. If `None`, the
1631+
hotkey_ss58: The SS58 address of the neuron's hotkey.
1632+
netuid: The unique identifier of the subnet to check the registration. If `None`, the
16311633
registration is checked across all subnets.
1632-
block (Optional[int]): The blockchain block number at which to perform the query.
1634+
block: The blockchain block number at which to perform the query.
1635+
block_hash: The blockchain block_hash representation of the block id. Do not specify if using block or
1636+
reuse_block
1637+
reuse_block (bool): Whether to reuse the last-used blockchain block hash. Do not set if using block_hash or
1638+
reuse_block.
16331639
16341640
Returns:
16351641
bool: `True` if the hotkey is registered in the specified context (either any subnet or a specific subnet),
@@ -1640,9 +1646,13 @@ async def is_hotkey_registered(
16401646
validation, and incentive distribution based on its registration status.
16411647
"""
16421648
if netuid is None:
1643-
return await self.is_hotkey_registered_any(hotkey_ss58, block)
1649+
return await self.is_hotkey_registered_any(
1650+
hotkey_ss58, block, block_hash, reuse_block
1651+
)
16441652
else:
1645-
return await self.is_hotkey_registered_on_subnet(hotkey_ss58, netuid, block)
1653+
return await self.is_hotkey_registered_on_subnet(
1654+
hotkey_ss58, netuid, block, block_hash, reuse_block
1655+
)
16461656

16471657
async def get_uid_for_hotkey_on_subnet(
16481658
self,

0 commit comments

Comments
 (0)