solana icon indicating copy to clipboard operation
solana copied to clipboard

`solana transfer {RECIPIENT} ALL` should fail when the source account has a zero balance

Open steveluscher opened this issue 1 year ago • 4 comments

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?

steveluscher avatar Nov 09 '23 17:11 steveluscher

It's not just the ALL case. solana transfer {recipient} 0 also works. Is there a particular reason why these should fail?

CriesofCarrots avatar Nov 09 '23 20:11 CriesofCarrots

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.

steveluscher avatar Nov 09 '23 21:11 steveluscher

Can i contribute to this issue?

Nagaprasadvr avatar Dec 03 '23 15:12 Nagaprasadvr

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)

kubanemil avatar May 13 '24 06:05 kubanemil