pub fn fix_optional_account_metas(
accounts: impl ToAccountMetas,
original: &Pubkey,
current: &Pubkey,
) -> Vec<AccountMeta>
Expand description
Change the pubkey
of any readonly, non-signer [AccountMeta
]
with the pubkey
equal to the original program id to the new one.
This is a workaround since Anchor will automatically set optional accounts
to the Program ID of the program that defines them when they are None
s,
if we use the same program but with different Program IDs, the optional
accounts will be set to the wrong addresses.
ยงWarning
Use this function only if you fully understand the implications.