Document self-transfer behavior (#743)

This commit is contained in:
Justin Starry 2020-10-28 10:48:23 +08:00 committed by GitHub
parent 6906200174
commit edb0a7deea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 4 deletions

View File

@ -362,10 +362,6 @@ Accounts hold token balances and are created using the `InitializeAccount`
instruction. Each Account has an owner who must be present as a signer in some instruction. Each Account has an owner who must be present as a signer in some
instructions. instructions.
Balances can be transferred between Accounts using the `Transfer` instruction.
The owner of the source Account must be present as a signer in the `Transfer`
instruction.
An Account's owner may transfer ownership of an account to another using the An Account's owner may transfer ownership of an account to another using the
`SetAuthority` instruction. `SetAuthority` instruction.
@ -375,6 +371,19 @@ instruction should be atomically processed with the system instruction that
creates the Solana account by including both instructions in the same creates the Solana account by including both instructions in the same
transaction. transaction.
### Transferring tokens
Balances can be transferred between Accounts using the `Transfer` instruction.
The owner of the source Account must be present as a signer in the `Transfer`
instruction when the source and destination accounts are different.
It's important to note that when the source and destination of a `Transfer` are
the **same**, the `Transfer` will _always_ succeed. Therefore, a successful `Transfer`
does not necessarily imply that the involved Accounts were valid SPL Token
accounts, that any tokens were moved, or that the source Account was present as
a signer. We strongly recommend that developers are careful about checking that
the source and destination are **different** before invoking a `Transfer`
instruction from within their program.
### Burning ### Burning
The `Burn` instruction decreases an Account's token balance without transferring The `Burn` instruction decreases an Account's token balance without transferring