File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -105,15 +105,7 @@ impl Action {
105105 params,
106106 signatures,
107107 } => {
108- let current_network_id = current_params. network_id ( ) ;
109- let transaction_network_id = params. network_id ( ) ;
110- if current_network_id != transaction_network_id {
111- return Err ( SyntaxError :: InvalidCustomAction ( format ! (
112- "The current network id is {} but the transaction tries to change the network id to {}" ,
113- current_network_id, transaction_network_id
114- ) ) )
115- }
116- params. verify ( ) . map_err ( SyntaxError :: InvalidCustomAction ) ?;
108+ params. verify_change ( current_params) . map_err ( SyntaxError :: InvalidCustomAction ) ?;
117109 let action = Action :: ChangeParams {
118110 metadata_seq : * metadata_seq,
119111 params : params. clone ( ) ,
Original file line number Diff line number Diff line change @@ -214,6 +214,19 @@ impl CommonParams {
214214 }
215215 Ok ( ( ) )
216216 }
217+
218+ pub fn verify_change ( & self , current_params : & Self ) -> Result < ( ) , String > {
219+ self . verify ( ) ?;
220+ let current_network_id = current_params. network_id ( ) ;
221+ let transaction_network_id = self . network_id ( ) ;
222+ if current_network_id != transaction_network_id {
223+ return Err ( format ! (
224+ "The current network id is {} but the transaction tries to change the network id to {}" ,
225+ current_network_id, transaction_network_id
226+ ) )
227+ }
228+ Ok ( ( ) )
229+ }
217230}
218231
219232const DEFAULT_PARAMS_SIZE : usize = 23 ;
You can’t perform that action at this time.
0 commit comments