@@ -34,12 +34,9 @@ async fn test_counter() {
3434 & address_tree_pubkey,
3535 & counter:: ID ,
3636 ) ;
37- let merkle_tree_pubkey = rpc. get_random_state_tree_info ( ) . unwrap ( ) . tree ;
38-
3937 create_counter (
4038 & payer,
4139 & mut rpc,
42- & merkle_tree_pubkey,
4340 address_tree_pubkey,
4441 address,
4542 )
@@ -109,7 +106,6 @@ async fn test_counter() {
109106pub async fn create_counter (
110107 payer : & Keypair ,
111108 rpc : & mut LightProgramTest ,
112- merkle_tree_pubkey : & Pubkey ,
113109 address_tree_pubkey : Pubkey ,
114110 address : [ u8 ; 32 ] ,
115111) -> Result < ( ) , RpcError > {
@@ -130,14 +126,16 @@ pub async fn create_counter(
130126 . await ?
131127 . value ;
132128
133- let output_merkle_tree_index = accounts. insert_or_get ( * merkle_tree_pubkey) ;
129+ let output_state_tree_index = rpc
130+ . get_random_state_tree_info ( ) ?
131+ . pack_output_tree_index ( & mut accounts) ?;
134132 let packed_address_tree_info = rpc_result. pack_tree_infos ( & mut accounts) . address_trees [ 0 ] ;
135133 let ( account_metas, _, _) = accounts. to_account_metas ( ) ;
136134
137135 let instruction_data = CreateCounterInstructionData {
138136 proof : rpc_result. proof ,
139137 address_tree_info : packed_address_tree_info,
140- output_state_tree_index : output_merkle_tree_index ,
138+ output_state_tree_index,
141139 } ;
142140 let inputs = instruction_data. try_to_vec ( ) . unwrap ( ) ;
143141
0 commit comments