From d2916bee619ca5a91944c1d5759d93f9d49c63d5 Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 19 Oct 2023 13:56:19 +0200 Subject: [PATCH] add multi-group comment --- token-group/example/src/lib.rs | 2 +- token-group/example/src/processor.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/token-group/example/src/lib.rs b/token-group/example/src/lib.rs index d476bbbab83..749eb07e34a 100644 --- a/token-group/example/src/lib.rs +++ b/token-group/example/src/lib.rs @@ -1,4 +1,4 @@ -//! Crate defining an example program for creating SPL token collections +//! Crate defining an example program for creating SPL token groups //! using the SPL Token Group interface. #![deny(missing_docs)] diff --git a/token-group/example/src/processor.rs b/token-group/example/src/processor.rs index 4a685441389..50bf7fbf3f1 100644 --- a/token-group/example/src/processor.rs +++ b/token-group/example/src/processor.rs @@ -189,7 +189,9 @@ pub fn process_initialize_member(_program_id: &Pubkey, accounts: &[AccountInfo]) // Allocate a TLV entry for the space and write it in let mut buffer = member_info.try_borrow_mut_data()?; let mut state = TlvStateMut::unpack(&mut buffer)?; - let (member, _) = state.init_value::(false)?; + // Note if `allow_repetition: true` is instead used here, one can initialize + // the same token as a member of multiple groups! + let (member, _) = state.init_value::(/* allow_repetition */ false)?; *member = TokenGroupMember::new(*group_info.key, member_number); Ok(())