@@ -34,7 +34,9 @@ use crate::{
34
34
} ,
35
35
errors:: BatchedMerkleTreeError ,
36
36
event:: {
37
- BatchAddressAppendEvent , BatchAppendEvent , BatchNullifyEvent , BATCH_EVENT_DISCRIMINATOR ,
37
+ BatchAddressAppendEvent , BatchAppendEvent , BatchNullifyEvent ,
38
+ BATCH_ADDRESS_APPEND_EVENT_DISCRIMINATOR , BATCH_APPEND_EVENT_DISCRIMINATOR ,
39
+ BATCH_NULLIFY_EVENT_DISCRIMINATOR ,
38
40
} ,
39
41
merkle_tree_metadata:: BatchedMerkleTreeMetadata ,
40
42
queue:: {
@@ -431,7 +433,7 @@ impl<'a> BatchedMerkleTreeAccount<'a> {
431
433
}
432
434
// 6. Return the batch append event.
433
435
Ok ( BatchAppendEvent {
434
- discriminator : BATCH_EVENT_DISCRIMINATOR ,
436
+ discriminator : BATCH_APPEND_EVENT_DISCRIMINATOR ,
435
437
tree_type : self . tree_type ,
436
438
merkle_tree_pubkey : self . pubkey . to_bytes ( ) ,
437
439
output_queue_pubkey : Some ( queue_account. pubkey ( ) . to_bytes ( ) ) ,
@@ -550,10 +552,15 @@ impl<'a> BatchedMerkleTreeAccount<'a> {
550
552
// Needs to be executed post mark_as_inserted_in_merkle_tree.
551
553
self . zero_out_previous_batch_bloom_filter ( ) ?;
552
554
}
555
+ let discriminator = if QueueType :: from ( QUEUE_TYPE ) == QueueType :: BatchedInput {
556
+ BATCH_NULLIFY_EVENT_DISCRIMINATOR
557
+ } else {
558
+ BATCH_ADDRESS_APPEND_EVENT_DISCRIMINATOR
559
+ } ;
553
560
554
561
// 6. Return the batch nullify/address append event.
555
562
Ok ( BatchNullifyEvent {
556
- discriminator : BATCH_EVENT_DISCRIMINATOR ,
563
+ discriminator,
557
564
tree_type : self . tree_type ,
558
565
merkle_tree_pubkey : self . pubkey . to_bytes ( ) ,
559
566
batch_index : pending_batch_index as u64 ,
@@ -975,7 +982,7 @@ pub fn assert_nullify_event(
975
982
. unwrap ( ) ;
976
983
let ref_event = BatchNullifyEvent {
977
984
merkle_tree_pubkey : mt_pubkey. to_bytes ( ) ,
978
- discriminator : BATCH_EVENT_DISCRIMINATOR ,
985
+ discriminator : BATCH_NULLIFY_EVENT_DISCRIMINATOR ,
979
986
tree_type : old_account. tree_type ,
980
987
output_queue_pubkey : None ,
981
988
batch_index,
@@ -1006,7 +1013,7 @@ pub fn assert_batch_append_event_event(
1006
1013
. unwrap ( ) ;
1007
1014
let ref_event = BatchAppendEvent {
1008
1015
merkle_tree_pubkey : mt_pubkey. to_bytes ( ) ,
1009
- discriminator : BATCH_EVENT_DISCRIMINATOR ,
1016
+ discriminator : BATCH_APPEND_EVENT_DISCRIMINATOR ,
1010
1017
tree_type : old_account. tree_type ,
1011
1018
output_queue_pubkey : Some ( old_output_queue_account. pubkey ( ) . to_bytes ( ) ) ,
1012
1019
batch_index,
@@ -1036,7 +1043,7 @@ pub fn assert_batch_adress_event(
1036
1043
. unwrap ( ) ;
1037
1044
let ref_event = BatchAppendEvent {
1038
1045
merkle_tree_pubkey : mt_pubkey. to_bytes ( ) ,
1039
- discriminator : BATCH_EVENT_DISCRIMINATOR ,
1046
+ discriminator : BATCH_ADDRESS_APPEND_EVENT_DISCRIMINATOR ,
1040
1047
tree_type : old_account. tree_type ,
1041
1048
output_queue_pubkey : None ,
1042
1049
batch_index,
0 commit comments