File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed
lang/attribute/program/src/declare_program/mods Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use anchor_lang_idl::types::Idl;
22use heck:: CamelCase ;
33use quote:: { format_ident, quote} ;
44
5- use super :: common:: { convert_idl_type_to_syn_type, gen_accounts_common, gen_discriminator } ;
5+ use super :: common:: { convert_idl_type_to_syn_type, gen_accounts_common} ;
66
77pub fn gen_cpi_mod ( idl : & Idl ) -> proc_macro2:: TokenStream {
88 let cpi_instructions = gen_cpi_instructions ( idl) ;
@@ -49,8 +49,6 @@ fn gen_cpi_instructions(idl: &Idl) -> proc_macro2::TokenStream {
4949 }
5050 } ;
5151
52- let discriminator = gen_discriminator ( & ix. discriminator ) ;
53-
5452 let ( ret_type, ret_value) = match ix. returns . as_ref ( ) {
5553 Some ( ty) => {
5654 let ty = convert_idl_type_to_syn_type ( ty) ;
@@ -73,7 +71,7 @@ fn gen_cpi_instructions(idl: &Idl) -> proc_macro2::TokenStream {
7371 let ix = {
7472 let ix = internal:: args:: #arg_value;
7573 let mut data = Vec :: with_capacity( 256 ) ;
76- data. extend_from_slice( & #discriminator ) ;
74+ data. extend_from_slice( internal :: args :: #accounts_ident :: DISCRIMINATOR ) ;
7775 AnchorSerialize :: serialize( & ix, & mut data)
7876 . map_err( |_| anchor_lang:: error:: ErrorCode :: InstructionDidNotSerialize ) ?;
7977
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ pub fn gen_events_mod(idl: &Idl) -> proc_macro2::TokenStream {
2121 impl anchor_lang:: Event for #name {
2222 fn data( & self ) -> Vec <u8 > {
2323 let mut data = Vec :: with_capacity( 256 ) ;
24- data. extend_from_slice( & #discriminator ) ;
24+ data. extend_from_slice( #name :: DISCRIMINATOR ) ;
2525 self . serialize( & mut data) . unwrap( ) ;
2626 data
2727 }
You can’t perform that action at this time.
0 commit comments