use {crate::state::*, anchor_lang::prelude::*};
#[derive(Accounts)]
pub struct ThreadReset<'info> {
#[account()]
pub authority: Signer<'info>,
#[account(
mut,
seeds = [
SEED_THREAD,
thread.authority.as_ref(),
thread.id.as_slice(),
],
bump = thread.bump,
has_one = authority
)]
pub thread: Account<'info, Thread>,
}
pub fn handler(ctx: Context<ThreadReset>) -> Result<()> {
let thread = &mut ctx.accounts.thread;
thread.next_instruction = None;
thread.exec_context = None;
thread.created_at = Clock::get().unwrap().into();
Ok(())
}