docs: add warning about manually closing accounts (#1490)
This commit is contained in:
parent
99403bff7e
commit
48138894b1
|
@ -340,6 +340,13 @@ impl<'info, T: AccountSerialize + AccountDeserialize + Owner + Clone> AccountsEx
|
|||
}
|
||||
}
|
||||
|
||||
/// This function is for INTERNAL USE ONLY.
|
||||
/// Do NOT use this function in a program.
|
||||
/// Manual closing of `Account<'info, T>` types is NOT supported.
|
||||
///
|
||||
/// Details: Using `close` with `Account<'info, T>` is not safe because
|
||||
/// it requires the `mut` constraint but for that type the constraint
|
||||
/// overwrites the "closed account" discriminator at the end of the instruction.
|
||||
impl<'info, T: AccountSerialize + AccountDeserialize + Owner + Clone> AccountsClose<'info>
|
||||
for Account<'info, T>
|
||||
{
|
||||
|
|
|
@ -231,6 +231,13 @@ impl<'info, T: ZeroCopy + Owner> AccountsExit<'info> for AccountLoader<'info, T>
|
|||
}
|
||||
}
|
||||
|
||||
/// This function is for INTERNAL USE ONLY.
|
||||
/// Do NOT use this function in a program.
|
||||
/// Manual closing of `AccountLoader<'info, T>` types is NOT supported.
|
||||
///
|
||||
/// Details: Using `close` with `AccountLoader<'info, T>` is not safe because
|
||||
/// it requires the `mut` constraint but for that type the constraint
|
||||
/// overwrites the "closed account" discriminator at the end of the instruction.
|
||||
impl<'info, T: ZeroCopy + Owner> AccountsClose<'info> for AccountLoader<'info, T> {
|
||||
fn close(&self, sol_destination: AccountInfo<'info>) -> Result<()> {
|
||||
crate::common::close(self.to_account_info(), sol_destination)
|
||||
|
|
|
@ -174,6 +174,13 @@ impl<'info, T: ZeroCopy> AccountsExit<'info> for Loader<'info, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// This function is for INTERNAL USE ONLY.
|
||||
/// Do NOT use this function in a program.
|
||||
/// Manual closing of `Loader<'info, T>` types is NOT supported.
|
||||
///
|
||||
/// Details: Using `close` with `Loader<'info, T>` is not safe because
|
||||
/// it requires the `mut` constraint but for that type the constraint
|
||||
/// overwrites the "closed account" discriminator at the end of the instruction.
|
||||
#[allow(deprecated)]
|
||||
impl<'info, T: ZeroCopy> AccountsClose<'info> for Loader<'info, T> {
|
||||
fn close(&self, sol_destination: AccountInfo<'info>) -> Result<()> {
|
||||
|
|
|
@ -104,6 +104,13 @@ impl<'info, T: AccountSerialize + AccountDeserialize + Clone> AccountsExit<'info
|
|||
}
|
||||
}
|
||||
|
||||
/// This function is for INTERNAL USE ONLY.
|
||||
/// Do NOT use this function in a program.
|
||||
/// Manual closing of `ProgramAccount<'info, T>` types is NOT supported.
|
||||
///
|
||||
/// Details: Using `close` with `ProgramAccount<'info, T>` is not safe because
|
||||
/// it requires the `mut` constraint but for that type the constraint
|
||||
/// overwrites the "closed account" discriminator at the end of the instruction.
|
||||
#[allow(deprecated)]
|
||||
impl<'info, T: AccountSerialize + AccountDeserialize + Clone> AccountsClose<'info>
|
||||
for ProgramAccount<'info, T>
|
||||
|
|
Loading…
Reference in New Issue