MCPcopy Create free account
hub / github.com/Lightprotocol/light-protocol-v1 / close_account

Function close_account

program/src/instructions.rs:235–249  ·  view source on GitHub ↗
(
    account: &AccountInfo,
    dest_account: &AccountInfo,
)

Source from the content-addressed store, hash-verified

233}
234
235pub fn close_account(
236 account: &AccountInfo,
237 dest_account: &AccountInfo,
238) -> Result<(), ProgramError> {
239 //close account by draining lamports
240 let dest_starting_lamports = dest_account.lamports();
241 msg!("dest_starting_lamports {}", dest_starting_lamports);
242 **dest_account.lamports.borrow_mut() = dest_starting_lamports
243 .checked_add(account.lamports())
244 .ok_or(ProgramError::InvalidAccountData)?;
245 **account.lamports.borrow_mut() = 0;
246 msg!("dest_ending_lamports {}", dest_account.lamports());
247
248 Ok(())
249}
250
251pub fn sol_transfer(
252 from_account: &AccountInfo,

Callers 1

process_instructionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected