@@ -331,6 +331,24 @@ const char *fmt_flow_full(const tal_t *ctx,
331331 return str ;
332332}
333333
334+ enum algorithm {
335+ ALGO_DEFAULT ,
336+ };
337+
338+ static struct command_result *
339+ param_algorithm (struct command * cmd , const char * name , const char * buffer ,
340+ const jsmntok_t * tok , enum algorithm * * algo )
341+ {
342+ const char * algo_str = json_strdup (cmd , buffer , tok );
343+ * algo = tal (cmd , enum algorithm );
344+ if (streq (algo_str , "default" ))
345+ * * algo = ALGO_DEFAULT ;
346+ else
347+ return command_fail_badparam (cmd , name , buffer , tok ,
348+ "unknown algorithm" );
349+ return NULL ;
350+ }
351+
334352struct getroutes_info {
335353 struct command * cmd ;
336354 struct node_id * source , * dest ;
@@ -340,6 +358,8 @@ struct getroutes_info {
340358 struct additional_cost_htable * additional_costs ;
341359 /* Non-NULL if we are told to use "auto.localchans" */
342360 struct layer * local_layer ;
361+ /* algorithm selection, only dev */
362+ enum algorithm * dev_algo ;
343363};
344364
345365static void apply_layers (struct askrene * askrene , struct route_query * rq ,
@@ -562,8 +582,9 @@ static struct command_result *do_getroutes(struct command *cmd,
562582 }
563583
564584 /* Compute the routes. At this point we might select between multiple
565- * algorithms. */
585+ * algorithms. Right now there is only one algorithm available. */
566586 struct timemono time_start = time_mono ();
587+ assert (* info -> dev_algo == ALGO_DEFAULT );
567588 err = default_routes (rq , rq , srcnode , dstnode , * info -> amount ,
568589 /* only one path? = */
569590 have_layer (info -> layers , "auto.no_mpp_support" ),
@@ -723,6 +744,8 @@ static struct command_result *json_getroutes(struct command *cmd,
723744 p_req ("final_cltv" , param_u32 , & info -> finalcltv ),
724745 p_opt_def ("maxdelay" , param_u32 , & info -> maxdelay ,
725746 maxdelay_allowed ),
747+ p_opt_dev ("dev_algorithm" , param_algorithm ,
748+ & info -> dev_algo , ALGO_DEFAULT ),
726749 NULL ))
727750 return command_param_failed ();
728751
0 commit comments