From bc73519f462f8466ba79c09cb13a4924064d1efc Mon Sep 17 00:00:00 2001 From: Armani Ferrante Date: Mon, 9 Aug 2021 04:02:49 -0700 Subject: [PATCH] Set owners and change threshold atomically (#5) --- programs/multisig/src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/programs/multisig/src/lib.rs b/programs/multisig/src/lib.rs index 6fcc732..b93c484 100644 --- a/programs/multisig/src/lib.rs +++ b/programs/multisig/src/lib.rs @@ -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, + 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, owners: Vec) -> Result<()> {