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

Method new

program/src/poseidon_merkle_tree/processor.rs:45–73  ·  view source on GitHub ↗
(
        tmp_storage_pda: Option<&'a AccountInfo<'b>>,
        merkle_tree_pda: Option<&'a AccountInfo<'b>>,
        program_id: Pubkey,
    )

Source from the content-addressed store, hash-verified

43
44impl<'a, 'b> MerkleTreeProcessor<'a, 'b> {
45 pub fn new(
46 tmp_storage_pda: Option<&'a AccountInfo<'b>>,
47 merkle_tree_pda: Option<&'a AccountInfo<'b>>,
48 program_id: Pubkey,
49 ) -> Result<Self, ProgramError> {
50 let empty_smt = MerkleTree {
51 is_initialized: false,
52 levels: 1,
53 filled_subtrees: vec![vec![0_u8; 1]; 1],
54 //zeros: vec![vec![0 as u8; 1];1],
55 current_root_index: 0,
56 next_index: 0,
57 root_history_size: 10,
58 roots: vec![0_u8; 1],
59 //leaves: vec![0],
60 current_total_deposits: 0,
61 inserted_leaf: false,
62 inserted_root: false,
63 pubkey_locked: vec![0],
64 time_locked: 0,
65 };
66
67 Ok(MerkleTreeProcessor {
68 merkle_tree_pda,
69 tmp_storage_pda,
70 unpacked_merkle_tree: empty_smt,
71 program_id,
72 })
73 }
74
75 #[allow(clippy::manual_memcpy)]
76 pub fn initialize_new_merkle_tree_from_bytes(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected