@@ -488,8 +488,6 @@ pub struct SimulationCfg {
488
488
write_results : Option < WriteResults > ,
489
489
/// Random number generator created from fixed seed.
490
490
seeded_rng : MutRng ,
491
- /// Results logger that holds the simulation statistics.
492
- results : Arc < Mutex < PaymentResultLogger > > ,
493
491
}
494
492
495
493
impl SimulationCfg {
@@ -506,7 +504,6 @@ impl SimulationCfg {
506
504
activity_multiplier,
507
505
write_results,
508
506
seeded_rng : MutRng :: new ( seed) ,
509
- results : Arc :: new ( Mutex :: new ( PaymentResultLogger :: new ( ) ) ) ,
510
507
}
511
508
}
512
509
}
@@ -519,6 +516,8 @@ pub struct Simulation {
519
516
nodes : HashMap < PublicKey , Arc < Mutex < dyn LightningNode > > > ,
520
517
/// The activity that are to be executed on the node.
521
518
activity : Vec < ActivityDefinition > ,
519
+ /// Results logger that holds the simulation statistics.
520
+ results : Arc < Mutex < PaymentResultLogger > > ,
522
521
/// High level triggers used to manage simulation tasks and shutdown.
523
522
shutdown_trigger : Trigger ,
524
523
shutdown_listener : Listener ,
@@ -553,6 +552,7 @@ impl Simulation {
553
552
cfg,
554
553
nodes,
555
554
activity,
555
+ results : Arc :: new ( Mutex :: new ( PaymentResultLogger :: new ( ) ) ) ,
556
556
shutdown_trigger,
557
557
shutdown_listener,
558
558
}
@@ -760,11 +760,11 @@ impl Simulation {
760
760
}
761
761
762
762
pub async fn get_total_payments ( & self ) -> u64 {
763
- self . cfg . results . lock ( ) . await . total_attempts ( )
763
+ self . results . lock ( ) . await . total_attempts ( )
764
764
}
765
765
766
766
pub async fn get_success_rate ( & self ) -> f64 {
767
- self . cfg . results . lock ( ) . await . success_rate ( )
767
+ self . results . lock ( ) . await . success_rate ( )
768
768
}
769
769
770
770
/// run_data_collection starts the tasks required for the simulation to report of the results of the activity that
@@ -798,7 +798,7 @@ impl Simulation {
798
798
}
799
799
} ) ;
800
800
801
- let result_logger = self . cfg . results . clone ( ) ;
801
+ let result_logger = self . results . clone ( ) ;
802
802
803
803
let result_logger_clone = result_logger. clone ( ) ;
804
804
let result_logger_listener = listener. clone ( ) ;
0 commit comments