MCPcopy Create free account
hub / github.com/Lightprotocol/light-protocol-v1 / unpack_from_slice

Method unpack_from_slice

program/src/nullifier_state.rs:23–36  ·  view source on GitHub ↗
(input: &[u8])

Source from the content-addressed store, hash-verified

21 const LEN: usize = 2;
22
23 fn unpack_from_slice(input: &[u8]) -> Result<Self, ProgramError> {
24 let input = array_ref![input, 0, NullifierState::LEN];
25
26 let (is_initialized, _account_type) = array_refs![input, 1, 1];
27
28 if is_initialized[0] != 0 {
29 msg!("nullifier already spent");
30 panic!();
31 }
32 Ok(NullifierState {
33 is_initialized: true,
34 account_type: 3,
35 })
36 }
37
38 fn pack_into_slice(&self, dst: &mut [u8]) {
39 let dst = array_mut_ref![dst, 0, NullifierState::LEN];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected