@@ -5,9 +5,15 @@ use log::LevelFilter;
55use serde:: { Deserialize , Serialize } ;
66use simln_lib:: clock:: SimulationClock ;
77use simln_lib:: sim_node:: {
8+ <<<<<<< HEAD
89 ln_node_from_graph, populate_network_graph, ChannelPolicy , CustomRecords , Interceptor ,
910 SimGraph , SimNode , SimulatedChannel ,
11+ =======
12+ ln_node_from_graph , populate_network_graph , ChannelPolicy , CustomRecords , Interceptor , PathFinder ,
13+ SimGraph , SimulatedChannel ,
14+ >>>>>>> 59 dbbe6 ( Add pathfinder trait )
1015} ;
16+
1117use simln_lib:: {
1218 cln , cln:: ClnNode , eclair, eclair:: EclairNode , lnd, lnd:: LndNode , serializers,
1319 ActivityDefinition , Amount , Interval , LightningError , LightningNode , NodeId , NodeInfo ,
@@ -241,6 +247,7 @@ struct NodeMapping {
241247 alias_node_map : HashMap < String , NodeInfo > ,
242248}
243249
250+ <<<<<<< HEAD
244251/// Creates a simulation that will run on an entirely-simulated network defined in `sim_params`,
245252/// returning the simulation, a validated vector of any defined activities that were specified and
246253/// a map of all the simulated nodes in the network. Note that if `sim_params::exclude` was set,
@@ -253,11 +260,16 @@ struct NodeMapping {
253260/// records set by the original sender of payments in their simulated `update_add_htlc`.
254261 pub async fn create_simulation_with_network(
255262 cfg : SimulationCfg ,
263+ =======
264+ pub async fn create_simulation_with_network < P : for < ' a > PathFinder < ' a > + Clone + ' static > (
265+ cli : & Cli ,
266+ >>>>>>> 59 dbbe6 ( Add pathfinder trait )
256267 sim_params : & SimParams ,
257268 clock : Arc < SimulationClock > ,
258269 tasks : TaskTracker ,
259270 interceptors : Vec < Arc < dyn Interceptor > > ,
260271 custom_records : CustomRecords ,
272+ <<<<<<< HEAD
261273) -> Result <
262274 (
263275 Simulation < SimulationClock > ,
@@ -266,6 +278,11 @@ pub async fn create_simulation_with_network(
266278 ) ,
267279 anyhow:: Error ,
268280> {
281+ =======
282+ pathfinder : P ,
283+ ) -> Result < ( Simulation < SimulationClock > , Vec < ActivityDefinition > ) , anyhow:: Error > {
284+ let cfg : SimulationCfg = SimulationCfg :: try_from ( cli ) ?;
285+ >>>>>>> 59 dbbe6 ( Add pathfinder trait )
269286 let SimParams {
270287 nodes: _,
271288 sim_network,
@@ -309,6 +326,7 @@ pub async fn create_simulation_with_network(
309326 . map_err( |e| SimulationError :: SimulatedNetworkError ( format ! ( "{:?}" , e) ) ) ?,
310327 ) ;
311328
329+ <<<<<<< HEAD
312330 // We want the full set of nodes in our graph to return to the caller so that they can take
313331 // custom actions on the simulated network. For the nodes we'll pass our simulation, cast them
314332 // to a dyn trait and exclude any nodes that shouldn't be included in random activity
@@ -322,6 +340,10 @@ pub async fn create_simulation_with_network(
322340 nodes_dyn. remove( pk) ;
323341 }
324342
343+ =======
344+ // Pass the pathfinder to ln_node_from_graph
345+ let nodes = ln_node_from_graph( simulation_graph. clone( ) , routing_graph, pathfinder) . await ;
346+ >>>>>>> 59 dbbe6 ( Add pathfinder trait )
325347 let validated_activities =
326348 get_validated_activities( & nodes_dyn, nodes_info, sim_params. activity. clone( ) ) . await ?;
327349
@@ -339,6 +361,7 @@ pub async fn create_simulation_with_network(
339361 ) )
340362}
341363
364+
342365/// Parses the cli options provided and creates a simulation to be run, connecting to lightning nodes and validating
343366 /// any activity described in the simulation file.
344367pub async fn create_simulation(
0 commit comments