@@ -496,16 +496,15 @@ pub trait SimNetwork: Send + Sync {
496496
497497/// A trait for custom pathfinding implementations.
498498/// Finds a route from the source node to the destination node for the specified amount.
499- ///
499+ ///
500500/// # Arguments
501501/// * `source` - The public key of the node initiating the payment.
502502/// * `dest` - The public key of the destination node to receive the payment.
503503/// * `amount_msat` - The amount to send in millisatoshis.
504504/// * `pathfinding_graph` - The network graph containing channel topology and routing information.
505- ///
505+ ///
506506/// # Returns
507507/// Returns a `Route` containing the payment path, or a `SimulationError` if no route is found.
508-
509508pub trait PathFinder : Send + Sync + Clone {
510509 fn find_route (
511510 & self ,
@@ -567,7 +566,7 @@ impl PathFinder for DefaultPathFinder {
567566/// all functionality through to a coordinating simulation network. This implementation contains both the [`SimNetwork`]
568567/// implementation that will allow us to dispatch payments and a read-only NetworkGraph that is used for pathfinding.
569568/// While these two could be combined, we re-use the LDK-native struct to allow re-use of their pathfinding logic.
570- pub struct SimNode < ' a , T : SimNetwork , P : PathFinder < ' a > = DefaultPathFinder > {
569+ pub struct SimNode < T : SimNetwork , P : PathFinder = DefaultPathFinder > {
571570 info : NodeInfo ,
572571 /// The underlying execution network that will be responsible for dispatching payments.
573572 network : Arc < Mutex < T > > ,
@@ -627,37 +626,6 @@ impl<T: SimNetwork, P: PathFinder> SimNode<T, P> {
627626
628627 Ok ( ( ) )
629628 }
630-
631- /// Dispatches a payment to a specified route.
632- /// The [`lightning::routing::router::build_route_from_hops`] function can be used to build the route to be passed here.
633- ///
634- /// **Note:** The payment hash passed in here should be used in track_payment to track the payment outcome.
635- pub async fn send_to_route (
636- & mut self ,
637- route : Route ,
638- payment_hash : PaymentHash ,
639- ) -> Result < ( ) , LightningError > {
640- let ( sender, receiver) = channel ( ) ;
641-
642- // Check for payment hash collision, failing the payment if we happen to repeat one.
643- match self . in_flight . entry ( payment_hash) {
644- Entry :: Occupied ( _) => {
645- return Err ( LightningError :: SendPaymentError (
646- "payment hash exists" . to_string ( ) ,
647- ) ) ;
648- } ,
649- Entry :: Vacant ( vacant) => {
650- vacant. insert ( receiver) ;
651- } ,
652- }
653-
654- self . network
655- . lock ( )
656- . await
657- . dispatch_payment ( self . info . pubkey , route, payment_hash, sender) ;
658-
659- Ok ( ( ) )
660- }
661629}
662630
663631/// Produces the node info for a mocked node, filling in the features that the simulator requires.
@@ -2348,6 +2316,7 @@ mod tests {
23482316 test_kit. nodes [ 0 ] ,
23492317 Arc :: new ( Mutex :: new ( test_kit. graph ) ) ,
23502318 test_kit. routing_graph . clone ( ) ,
2319+ test_kit. pathfinder . clone ( ) ,
23512320 ) ;
23522321
23532322 let route = build_route_from_hops (
0 commit comments