@@ -496,16 +496,15 @@ pub trait SimNetwork: Send + Sync {
496
496
497
497
/// A trait for custom pathfinding implementations.
498
498
/// Finds a route from the source node to the destination node for the specified amount.
499
- ///
499
+ ///
500
500
/// # Arguments
501
501
/// * `source` - The public key of the node initiating the payment.
502
502
/// * `dest` - The public key of the destination node to receive the payment.
503
503
/// * `amount_msat` - The amount to send in millisatoshis.
504
504
/// * `pathfinding_graph` - The network graph containing channel topology and routing information.
505
- ///
505
+ ///
506
506
/// # Returns
507
507
/// Returns a `Route` containing the payment path, or a `SimulationError` if no route is found.
508
-
509
508
pub trait PathFinder : Send + Sync + Clone {
510
509
fn find_route (
511
510
& self ,
@@ -567,7 +566,7 @@ impl PathFinder for DefaultPathFinder {
567
566
/// all functionality through to a coordinating simulation network. This implementation contains both the [`SimNetwork`]
568
567
/// implementation that will allow us to dispatch payments and a read-only NetworkGraph that is used for pathfinding.
569
568
/// 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 > {
571
570
info : NodeInfo ,
572
571
/// The underlying execution network that will be responsible for dispatching payments.
573
572
network : Arc < Mutex < T > > ,
@@ -627,37 +626,6 @@ impl<T: SimNetwork, P: PathFinder> SimNode<T, P> {
627
626
628
627
Ok ( ( ) )
629
628
}
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
- }
661
629
}
662
630
663
631
/// Produces the node info for a mocked node, filling in the features that the simulator requires.
@@ -2348,6 +2316,7 @@ mod tests {
2348
2316
test_kit. nodes [ 0 ] ,
2349
2317
Arc :: new ( Mutex :: new ( test_kit. graph ) ) ,
2350
2318
test_kit. routing_graph . clone ( ) ,
2319
+ test_kit. pathfinder . clone ( ) ,
2351
2320
) ;
2352
2321
2353
2322
let route = build_route_from_hops (
0 commit comments