Skip to content

Commit

Permalink
Set owners and change threshold atomically (coral-xyz#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
armaniferrante authored Aug 9, 2021
1 parent 3832a0c commit bc73519
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions programs/multisig/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ pub mod multisig {
Ok(())
}

// Set owners and threshold at once.
pub fn set_owners_and_change_threshold<'info>(
ctx: Context<'_, '_, '_, 'info, Auth<'info>>,
owners: Vec<Pubkey>,
threshold: u64,
) -> Result<()> {
set_owners(
Context::new(ctx.program_id, ctx.accounts, ctx.remaining_accounts),
owners,
)?;
change_threshold(ctx, threshold)
}

// Sets the owners field on the multisig. The only way this can be invoked
// is via a recursive call from execute_transaction -> set_owners.
pub fn set_owners(ctx: Context<Auth>, owners: Vec<Pubkey>) -> Result<()> {
Expand Down

0 comments on commit bc73519

Please sign in to comment.