Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bittensor/core/extrinsics/asyncex/staking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions bittensor/core/extrinsics/staking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading