@@ -1066,7 +1066,7 @@ impl<C: Clock + 'static> Simulation<C> {
10661066 payments_completed : 0 ,
10671067 } ;
10681068 payments_tracker. insert ( source, payment_tracker) ;
1069- generate_payment ( & mut heap, source, 0 , & mut payments_tracker, now) . await ?;
1069+ generate_payment ( & mut heap, source, & mut payments_tracker, now) . await ?;
10701070 }
10711071
10721072 // ppe: produce payment events
@@ -1165,14 +1165,13 @@ async fn produce_payment_events<C: Clock>(
11651165 log:: debug!(
11661166 "Skipping zero amount payment for {source} -> {}." , destination
11671167 ) ;
1168- generate_payment( & mut heap, source, payment_tracker . payments_completed , & mut payments_tracker, clock. now( ) ) . await ?;
1168+ generate_payment( & mut heap, source, & mut payments_tracker, clock. now( ) ) . await ?;
11691169 continue ;
11701170 }
11711171
1172- let next_payment_count = payment_tracker. payments_completed + 1 ;
11731172 payments_tracker
11741173 . entry( source)
1175- . and_modify( |p| p. payments_completed = next_payment_count ) ;
1174+ . and_modify( |p| p. payments_completed = p . payments_completed + 1 ) ;
11761175
11771176 select! {
11781177 biased;
@@ -1182,7 +1181,7 @@ async fn produce_payment_events<C: Clock>(
11821181 // Wait until our time to next payment has elapsed then execute a random amount payment to a random
11831182 // destination.
11841183 _ = pe_clock. sleep( wait_time) => {
1185- generate_payment( & mut heap, source, next_payment_count , & mut payments_tracker, clock. now( ) ) . await ?;
1184+ generate_payment( & mut heap, source, & mut payments_tracker, clock. now( ) ) . await ?;
11861185
11871186 tasks. spawn( async move {
11881187 log:: debug!( "Generated payment: {source} -> {}: {amount} msat." , destination) ;
@@ -1214,7 +1213,6 @@ async fn produce_payment_events<C: Clock>(
12141213async fn generate_payment (
12151214 heap : & mut BinaryHeap < Reverse < PaymentEvent > > ,
12161215 pubkey : PublicKey ,
1217- current_count : u64 ,
12181216 payments_tracker : & mut HashMap < PublicKey , ExecutorPaymentTracker > ,
12191217 base_time : SystemTime ,
12201218) -> Result < ( ) , SimulationError > {
@@ -1225,7 +1223,7 @@ async fn generate_payment(
12251223 PaymentGenerationError ( format ! ( "executor {} not found" , pubkey) ) ,
12261224 ) ) ?;
12271225 let wait_time = get_payment_delay (
1228- current_count ,
1226+ payment_tracker . payments_completed ,
12291227 & payment_tracker. executor . source_info ,
12301228 payment_tracker. executor . payment_generator . as_ref ( ) ,
12311229 ) ?;
0 commit comments