@@ -495,7 +495,7 @@ pub struct SimNode<'a, T: SimNetwork> {
495495 /// The underlying execution network that will be responsible for dispatching payments.
496496 network : Arc < Mutex < T > > ,
497497 /// Tracks the channel that will provide updates for payments by hash.
498- in_flight : Mutex < HashMap < PaymentHash , Receiver < Result < PaymentResult , LightningError > > > > , // HashMap<PaymentHash, Receiver<Result<PaymentResult, LightningError>>>,
498+ in_flight : Mutex < HashMap < PaymentHash , Receiver < Result < PaymentResult , LightningError > > > > ,
499499 /// A read-only graph used for pathfinding.
500500 pathfinding_graph : Arc < NetworkGraph < & ' a WrappedLog > > ,
501501 /// Probabilistic scorer used to rank paths through the network for routing. This is reused across
@@ -523,7 +523,7 @@ impl<'a, T: SimNetwork> SimNode<'a, T> {
523523 SimNode {
524524 info,
525525 network : payment_network,
526- in_flight : HashMap :: new ( ) . into ( ) ,
526+ in_flight : Mutex :: new ( HashMap :: new ( ) ) ,
527527 pathfinding_graph,
528528 scorer,
529529 }
@@ -630,8 +630,7 @@ impl<T: SimNetwork> LightningNode for SimNode<'_, T> {
630630 let payment_hash = preimage. into ( ) ;
631631
632632 // Check for payment hash collision, failing the payment if we happen to repeat one.
633- let mut in_flight = self . in_flight . lock ( ) . await ;
634- match in_flight. entry ( payment_hash) {
633+ match self . in_flight . lock ( ) . await . entry ( payment_hash) {
635634 Entry :: Occupied ( _) => {
636635 return Err ( LightningError :: SendPaymentError (
637636 "payment hash exists" . to_string ( ) ,
0 commit comments