From be70755faf151798631f7c7b42c7d0c676909aa3 Mon Sep 17 00:00:00 2001 From: armaniferrante Date: Wed, 10 Mar 2021 11:22:41 -0800 Subject: [PATCH] Enable set_owners to complete test --- programs/multisig/src/lib.rs | 22 +++++++++++----------- tests/multisig.js | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/programs/multisig/src/lib.rs b/programs/multisig/src/lib.rs index 7353ee6..2740001 100644 --- a/programs/multisig/src/lib.rs +++ b/programs/multisig/src/lib.rs @@ -87,20 +87,20 @@ pub mod multisig { Ok(()) } - /* - // 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<()> { - let multisig = &mut ctx.accounts.multisig; - if (owners.len() as u64) < multisig.threshold { - multisig.threshold = owners.len() as u64; - } + // 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<()> { + let multisig = &mut ctx.accounts.multisig; - multisig.owners = owners; - Ok(()) + if (owners.len() as u64) < multisig.threshold { + multisig.threshold = owners.len() as u64; } - */ + + multisig.owners = owners; + Ok(()) + } + // Changes the execution threshold of the multisig. The only way this can be // invoked is via a recursive call from execute_transaction -> // change_threshold. diff --git a/tests/multisig.js b/tests/multisig.js index 72fc035..4001f8d 100644 --- a/tests/multisig.js +++ b/tests/multisig.js @@ -57,7 +57,7 @@ describe("multisig", () => { isWritable: false, isSigner: true, }, - ];/* + ]; const newOwners = [ownerA.publicKey, ownerB.publicKey, ownerD.publicKey]; const data = program.coder.instruction.encode('set_owners', { owners: newOwners, @@ -128,6 +128,6 @@ describe("multisig", () => { assert.equal(multisigAccount.nonce, nonce); assert.ok(multisigAccount.threshold.eq(new anchor.BN(2))); - assert.deepEqual(multisigAccount.owners, newOwners);*/ + assert.deepEqual(multisigAccount.owners, newOwners); }); });