@@ -331,6 +331,24 @@ const char *fmt_flow_full(const tal_t *ctx,
331
331
return str ;
332
332
}
333
333
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
+
334
352
struct getroutes_info {
335
353
struct command * cmd ;
336
354
struct node_id * source , * dest ;
@@ -340,6 +358,8 @@ struct getroutes_info {
340
358
struct additional_cost_htable * additional_costs ;
341
359
/* Non-NULL if we are told to use "auto.localchans" */
342
360
struct layer * local_layer ;
361
+ /* algorithm selection, only dev */
362
+ enum algorithm * dev_algo ;
343
363
};
344
364
345
365
static void apply_layers (struct askrene * askrene , struct route_query * rq ,
@@ -562,8 +582,9 @@ static struct command_result *do_getroutes(struct command *cmd,
562
582
}
563
583
564
584
/* Compute the routes. At this point we might select between multiple
565
- * algorithms. */
585
+ * algorithms. Right now there is only one algorithm available. */
566
586
struct timemono time_start = time_mono ();
587
+ assert (* info -> dev_algo == ALGO_DEFAULT );
567
588
err = default_routes (rq , rq , srcnode , dstnode , * info -> amount ,
568
589
/* only one path? = */
569
590
have_layer (info -> layers , "auto.no_mpp_support" ),
@@ -723,6 +744,8 @@ static struct command_result *json_getroutes(struct command *cmd,
723
744
p_req ("final_cltv" , param_u32 , & info -> finalcltv ),
724
745
p_opt_def ("maxdelay" , param_u32 , & info -> maxdelay ,
725
746
maxdelay_allowed ),
747
+ p_opt_dev ("dev_algorithm" , param_algorithm ,
748
+ & info -> dev_algo , ALGO_DEFAULT ),
726
749
NULL ))
727
750
return command_param_failed ();
728
751
0 commit comments