pub fn safe_close(
account: &AccountView,
destination: &AccountView,
) -> ProgramResultExpand description
Close account, sending all its lamports to destination.
Steps:
- Overflow-checked addition of lamports into
destination. - Zero
accountlamports. close_unchecked(): zeros data and clears the owner field.
Both accounts must be writable - caller is responsible for that check.
ยงSafety
Caller must guarantee no active borrows exist on account at call time.