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 statestate
variable of SomeStruct
in the initializer of the contract, which can't be initialized twice using the initializer functionreinitialized.
pub fn lock_tokens(ctx: Context<SomeStruct>, amount: u64) -> Result<()> {
...
}
This functionlock_tokens
now needs the SomeStructSomeStruct
to perform its internal logic. Is it possible for someone to initialize their own statestate
account with dummy data and pass it into the contract in SomeStruct
? If so, how can one do that?