1818use ckey:: Address ;
1919use cstate:: { StateError , TopState , TopStateView } ;
2020use ctypes:: errors:: { HistoryError , SyntaxError } ;
21- use ctypes:: transaction:: { Action , AssetTransferInput , OrderOnTransfer , Timelock } ;
21+ use ctypes:: transaction:: { Action , AssetTransferInput , Timelock } ;
2222use ctypes:: { CommonParams , Header } ;
2323
2424use crate :: block:: { ExecutedBlock , IsBlock } ;
@@ -28,14 +28,12 @@ use crate::transaction::{SignedTransaction, UnverifiedTransaction};
2828
2929pub struct CodeChainMachine {
3030 params : CommonParams ,
31- is_order_disabled : bool ,
3231}
3332
3433impl CodeChainMachine {
3534 pub fn new ( params : CommonParams ) -> Self {
3635 CodeChainMachine {
3736 params,
38- is_order_disabled : is_order_disabled ( ) ,
3937 }
4038 }
4139
@@ -58,7 +56,7 @@ impl CodeChainMachine {
5856 }
5957 . into ( ) )
6058 }
61- tx. verify_with_params ( common_params, self . is_order_disabled ) ?;
59+ tx. verify_with_params ( common_params) ?;
6260
6361 Ok ( ( ) )
6462 }
@@ -79,7 +77,6 @@ impl CodeChainMachine {
7977 ) -> Result < ( ) , Error > {
8078 if let Action :: TransferAsset {
8179 inputs,
82- orders,
8380 expiration,
8481 ..
8582 } = & tx. action
@@ -88,7 +85,6 @@ impl CodeChainMachine {
8885 if verify_timelock {
8986 Self :: verify_transfer_timelock ( inputs, header, client) ?;
9087 }
91- Self :: verify_transfer_order_expired ( orders, header) ?;
9288 }
9389 // FIXME: Filter transactions.
9490 Ok ( ( ) )
@@ -176,19 +172,6 @@ impl CodeChainMachine {
176172 Ok ( ( ) )
177173 }
178174
179- fn verify_transfer_order_expired ( orders : & [ OrderOnTransfer ] , header : & Header ) -> Result < ( ) , Error > {
180- for order_tx in orders {
181- if order_tx. order . expiration < header. timestamp ( ) {
182- return Err ( HistoryError :: OrderExpired {
183- expiration : order_tx. order . expiration ,
184- timestamp : header. timestamp ( ) ,
185- }
186- . into ( ) )
187- }
188- }
189- Ok ( ( ) )
190- }
191-
192175 pub fn min_cost ( params : & CommonParams , action : & Action ) -> u64 {
193176 match action {
194177 Action :: MintAsset {
@@ -250,16 +233,3 @@ impl CodeChainMachine {
250233 Ok ( ( ) )
251234 }
252235}
253-
254- fn is_order_disabled ( ) -> bool {
255- #[ cfg( test) ]
256- const DEFAULT_ORDER_DISABLED : bool = false ;
257- #[ cfg( not( test) ) ]
258- const DEFAULT_ORDER_DISABLED : bool = true ;
259- let var = std:: env:: var ( "ENABLE_ORDER" ) ;
260- match var. as_ref ( ) . map ( |x| x. trim ( ) ) {
261- Ok ( value) => !value. parse :: < bool > ( ) . unwrap ( ) ,
262- Err ( std:: env:: VarError :: NotPresent ) => DEFAULT_ORDER_DISABLED ,
263- Err ( err) => unreachable ! ( "{:?}" , err) ,
264- }
265- }
0 commit comments