@@ -206,6 +206,8 @@ pub struct RawLateTXAttackConfig {
206206 pub attackers : NodeSelection ,
207207 pub attack_probability : f64 ,
208208 pub tx_generation_distribution : DistributionConfig ,
209+ pub tx_start_time : Option < f64 > ,
210+ pub tx_stop_time : Option < f64 > ,
209211}
210212
211213#[ derive( Deserialize ) ]
@@ -617,7 +619,7 @@ impl AttackConfig {
617619 late_tx : params
618620 . late_tx_attack
619621 . as_ref ( )
620- . map ( |raw| LateTXAttackConfig :: build ( raw, topology) ) ,
622+ . map ( |raw| LateTXAttackConfig :: build ( raw, topology, params ) ) ,
621623 }
622624 }
623625}
@@ -645,16 +647,26 @@ impl LateEBAttackConfig {
645647pub ( crate ) struct LateTXAttackConfig {
646648 pub ( crate ) probability : f64 ,
647649 pub ( crate ) txs_to_generate : FloatDistribution ,
650+ pub ( crate ) start_time : Option < Timestamp > ,
651+ pub ( crate ) stop_time : Option < Timestamp > ,
648652}
649653
650654impl LateTXAttackConfig {
651- fn build ( raw : & RawLateTXAttackConfig , topology : & mut Topology ) -> Self {
655+ fn build ( raw : & RawLateTXAttackConfig , topology : & mut Topology , params : & RawParameters ) -> Self {
652656 for attacker in topology. select ( & raw . attackers) {
653657 attacker. behaviours . withhold_txs = true ;
654658 }
655659 Self {
656660 probability : raw. attack_probability ,
657661 txs_to_generate : raw. tx_generation_distribution . into ( ) ,
662+ start_time : raw
663+ . tx_start_time
664+ . or ( params. tx_start_time )
665+ . map ( |t| Timestamp :: zero ( ) + Duration :: from_secs_f64 ( t) ) ,
666+ stop_time : raw
667+ . tx_stop_time
668+ . or ( params. tx_stop_time )
669+ . map ( |t| Timestamp :: zero ( ) + Duration :: from_secs_f64 ( t) ) ,
658670 }
659671 }
660672}
0 commit comments