diff --git a/bittensor/core/extrinsics/asyncex/staking.py b/bittensor/core/extrinsics/asyncex/staking.py index 69d6236199..8ceaa4f98c 100644 --- a/bittensor/core/extrinsics/asyncex/staking.py +++ b/bittensor/core/extrinsics/asyncex/staking.py @@ -89,6 +89,13 @@ async def add_stake_extrinsic( subtensor.get_existential_deposit(block_hash=block_hash), ) + # Leave existential balance to keep key alive. + if old_balance <= existential_deposit: + return ExtrinsicResponse( + False, + f"Balance ({old_balance}) is not enough to cover existential deposit `{existential_deposit}`.", + ).with_log() + # Leave existential balance to keep key alive. if amount > old_balance - existential_deposit: # If we are staking all, we need to leave at least the existential deposit. diff --git a/bittensor/core/extrinsics/staking.py b/bittensor/core/extrinsics/staking.py index e53e04aa2a..a8f3d4c913 100644 --- a/bittensor/core/extrinsics/staking.py +++ b/bittensor/core/extrinsics/staking.py @@ -86,6 +86,13 @@ def add_stake_extrinsic( ) existential_deposit = subtensor.get_existential_deposit(block=block) + # Leave existential balance to keep key alive. + if old_balance <= existential_deposit: + return ExtrinsicResponse( + False, + f"Balance ({old_balance}) is not enough to cover existential deposit `{existential_deposit}`.", + ).with_log() + # Leave existential balance to keep key alive. if amount > old_balance - existential_deposit: # If we are staking all, we need to leave at least the existential deposit.