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 @@ -220,6 +220,19 @@ impl CommonParams {
220220 }
221221 Ok ( ( ) )
222222 }
223+
224+ pub fn verify_change ( & self , current_params : & Self ) -> Result < ( ) , String > {
225+ self . verify ( ) ?;
226+ let current_network_id = current_params. network_id ( ) ;
227+ let transaction_network_id = self . network_id ( ) ;
228+ if current_network_id != transaction_network_id {
229+ return Err ( format ! (
230+ "The current network id is {} but the transaction tries to change the network id to {}" ,
231+ current_network_id, transaction_network_id
232+ ) )
233+ }
234+
235+ }
223236}
224237
225238const DEFAULT_PARAMS_SIZE : usize = 23 ;
You can’t perform that action at this time.
0 commit comments