I have this in my lib.rs file:
#[derive(Accounts)]
pub struct Initialize<'info> {
#[account(
init,
payer = authority,
space = 8 + Config::SIZE,
seeds = ["config".as_bytes().as_ref()],
bump
)]
config: Box<Account<'info, Config>>,
#[account(mut)]
authority: Signer<'info>,
native_token_mint: Account<'info, Mint>,
system_program: Program<'info, System>,
rent: Sysvar<'info, Rent>
}
and in my test.ts file:
await program.methods
.initialize()
.accounts({
config: configAddress,
authority: admin.publicKey,
nativeTokenMint: nativeMintAddress,
//systemProgram: anchor.web3.SystemProgram.programId,
//rent: anchor.web3.SYSVAR_RENT_PUBKEY
})
.signers([admin])
.rpc();
Running the test passes on the first try each time I rebuild and redeploy the program but fails everytime after that with the error above. I've checked and now I know that 0x0 means "Lamport balance below rent-exempt threshold" but I have no idea what that means and even if I did, how to solve this error.
SystemInstruction::CreateAccount
the system program's error 0 isAccountInUse
, not sub-rent-exempt lamports balance