Skip to content

Commit

Permalink
fix(add-member-realloc): clean up accountmeta and accountinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
ogmedia committed Aug 4, 2022
1 parent 99295c0 commit b15eed3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions programs/squads-mpl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,10 @@ pub mod squads_mpl {
if &ix.program_id != ctx.program_id {
return err!(MsError::InvalidAuthorityIndex);
}
if add_member_discriminator == ix.data[0..8] {
ix.accounts[2].pubkey = *ctx.accounts.member.key;
ix_account_infos[3].key = ctx.accounts.member.key;
// since the add member may need to pay realloc, switch the payer
if Some(add_member_discriminator.as_slice()) == ix.data.get(0..8) {
ix.accounts[2] = AccountMeta::new(*ctx.accounts.member.key, true);
ix_account_infos[3] = ctx.accounts.member.to_account_info();
}
invoke_signed(
&ix,
Expand Down

0 comments on commit b15eed3

Please sign in to comment.