Skip to main content
2 of 2
added 12 characters in body
zOthix
  • 101
  • 1

Can users pass Dummy State Accounts in Solana Program?

I'm working with a Solana program and I have the following code:

#[derive(Accounts)]
pub struct SomeStruct<'info> {
    #[account()]
    pub state: Account<'info, State>,
    ....
}

I'm initializing this state variable of SomeStruct in the initializer of the contract, which can't be reinitialized.

pub fn lock_tokens(ctx: Context<SomeStruct>, amount: u64) -> Result<()> {
   ...
}

lock_tokens now needs the SomeStruct to perform its internal logic. Is it possible for someone to initialize their own state account with dummy data and pass it into the contract in SomeStruct? If so, how can one do that?

zOthix
  • 101
  • 1