0

    #[account(
        init,
        seeds = [
            AMM_CONFIG_SEED.as_bytes()
        ],
        bump,
        payer = admin,
        space = 8 + AmmConfig::INIT_SPACE,
    )]
    pub amm_config: Account<'info, AmmConfig>,


as shown here, the seed is constant , but the program uses a bump which varies to get a valid PDA address , so if I called this instruction to create this account amm_config multiple times , will it fail or success ??

The PDA will be created with the same program ID and the same seed; will it fail or pass?

1 Answer 1

0

it will fail with an error "account already in use". Same seed = same address. You can't create an account that already exists.

If your seed is constant like this, why not creating the account first, and then remove the init ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.