solana
solana copied to clipboard
`solana transfer {RECIPIENT} ALL` should fail when the source account has a zero balance
Problem
If the source account has a zero balance…
solana transfer {RECIPIENT} ALL
Will happily spend a transaction fee to land a transaction that transfers zero lamports.
Proposed Solution
Should it fatal if the account balance is zero?
It's not just the ALL
case. solana transfer {recipient} 0
also works. Is there a particular reason why these should fail?
I had the wrong FROM address for {reasons} so solana transfer {RECIPIENT} ALL
kept happily making me pay for nothingburger transactions, which I found frustrating. I feel that the semantics between 0 and ALL are different enough (in terms of my expectations of what ALL should do, given the impetus for its introduction) that ALL should fatal, whereas the explicit 0 should go.
Can i contribute to this issue?
This issue should be closed as transfer from zero-balance account will return this error:
Error: Account {SOURCE_PUBKEY} has insufficient funds for spend (0 SOL) + fee (x SOL)