@@ -347,6 +347,24 @@ static struct amount_msat linear_flows_cost(struct flow **flows,
347347 return total ;
348348}
349349
350+ enum algorithm {
351+ ALGO_DEFAULT ,
352+ };
353+
354+ static struct command_result *
355+ param_algorithm (struct command * cmd , const char * name , const char * buffer ,
356+ const jsmntok_t * tok , enum algorithm * * algo )
357+ {
358+ const char * algo_str = json_strdup (cmd , buffer , tok );
359+ * algo = tal (cmd , enum algorithm );
360+ if (streq (algo_str , "default" ))
361+ * * algo = ALGO_DEFAULT ;
362+ else
363+ return command_fail_badparam (cmd , name , buffer , tok ,
364+ "unknown algorithm" );
365+ return NULL ;
366+ }
367+
350368struct getroutes_info {
351369 struct command * cmd ;
352370 struct node_id * source , * dest ;
@@ -356,6 +374,8 @@ struct getroutes_info {
356374 struct additional_cost_htable * additional_costs ;
357375 /* Non-NULL if we are told to use "auto.localchans" */
358376 struct layer * local_layer ;
377+ /* algorithm selection, only dev */
378+ enum algorithm * dev_algo ;
359379};
360380
361381static void apply_layers (struct askrene * askrene , struct route_query * rq ,
@@ -581,8 +601,9 @@ static struct command_result *do_getroutes(struct command *cmd,
581601 }
582602
583603 /* Compute the routes. At this point we might select between multiple
584- * algorithms. */
604+ * algorithms. Right now there is only one algorithm available. */
585605 struct timemono time_start = time_mono ();
606+ assert (* info -> dev_algo == ALGO_DEFAULT );
586607 err = default_routes (rq , rq , srcnode , dstnode , * info -> amount ,
587608 /* only one path? = */
588609 have_layer (info -> layers , "auto.no_mpp_support" ),
@@ -749,6 +770,8 @@ static struct command_result *json_getroutes(struct command *cmd,
749770 p_req ("final_cltv" , param_u32 , & info -> finalcltv ),
750771 p_opt_def ("maxdelay" , param_u32 , & info -> maxdelay ,
751772 maxdelay_allowed ),
773+ p_opt_dev ("dev_algorithm" , param_algorithm ,
774+ & info -> dev_algo , ALGO_DEFAULT ),
752775 NULL ))
753776 return command_param_failed ();
754777
0 commit comments