Skip to content

Commit 34b71ec

Browse files
committed
Improve language for childkey revoke
1 parent b2e208b commit 34b71ec

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

bittensor_cli/src/commands/stake/children_hotkeys.py

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -622,14 +622,23 @@ async def revoke_children(
622622
wait_for_inclusion=wait_for_inclusion,
623623
wait_for_finalization=wait_for_finalization,
624624
)
625-
dict_output[netuid] = {"success": success, "error": message}
625+
dict_output[netuid] = {
626+
"success": success,
627+
"error": message,
628+
"set_block": None,
629+
"completion_block": None,
630+
}
626631

627632
# Result
628633
if success:
629-
if wait_for_finalization and wait_for_inclusion:
630-
await get_children(wallet, subtensor, netuid)
634+
current_block, completion_block = await get_childkey_completion_block(
635+
subtensor, netuid
636+
)
637+
dict_output[netuid]["completion_block"] = completion_block
638+
dict_output[netuid]["set_block"] = current_block
631639
console.print(
632-
":white_heavy_check_mark: [green]Revoked children hotkeys.[/green]"
640+
f":white_heavy_check_mark: Your childkey revocation request for netuid {netuid} has been submitted. "
641+
f"It will be completed around block {completion_block}. The current block is {current_block}"
633642
)
634643
else:
635644
console.print(
@@ -638,10 +647,10 @@ async def revoke_children(
638647
else:
639648
# revoke children from ALL netuids
640649
netuids = await subtensor.get_all_subnet_netuids()
641-
for netuid in netuids:
642-
if netuid == 0: # dont include root network
650+
for netuid_ in netuids:
651+
if netuid_ == 0: # dont include root network
643652
continue
644-
console.print(f"Revoking children from netuid {netuid}.")
653+
console.print(f"Revoking children from netuid {netuid_}.")
645654
success, message = await set_children_extrinsic(
646655
subtensor=subtensor,
647656
wallet=wallet,
@@ -652,10 +661,23 @@ async def revoke_children(
652661
wait_for_inclusion=True,
653662
wait_for_finalization=False,
654663
)
655-
dict_output[netuid] = {"success": success, "error": message}
656-
console.print(
657-
":white_heavy_check_mark: [green]Sent revoke children command. Finalization may take a few minutes.[/green]"
658-
)
664+
dict_output[netuid_] = {
665+
"success": success,
666+
"error": message,
667+
"set_block": None,
668+
"completion_block": None,
669+
}
670+
if success:
671+
current_block, completion_block = await get_childkey_completion_block(
672+
subtensor, netuid_
673+
)
674+
dict_output[netuid_]["completion_block"] = completion_block
675+
dict_output[netuid_]["set_block"] = current_block
676+
console.print(
677+
f":white_heavy_check_mark: Your childkey revocation request for netuid {netuid_} has been "
678+
f"submitted. It will be completed around block {completion_block}. The current block "
679+
f"is {current_block}"
680+
)
659681
if json_output:
660682
json_console.print(json.dumps(dict_output))
661683

0 commit comments

Comments
 (0)