@@ -347,6 +347,24 @@ static struct amount_msat linear_flows_cost(struct flow **flows,
347
347
return total ;
348
348
}
349
349
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
+
350
368
struct getroutes_info {
351
369
struct command * cmd ;
352
370
struct node_id * source , * dest ;
@@ -356,6 +374,8 @@ struct getroutes_info {
356
374
struct additional_cost_htable * additional_costs ;
357
375
/* Non-NULL if we are told to use "auto.localchans" */
358
376
struct layer * local_layer ;
377
+ /* algorithm selection, only dev */
378
+ enum algorithm * dev_algo ;
359
379
};
360
380
361
381
static void apply_layers (struct askrene * askrene , struct route_query * rq ,
@@ -581,8 +601,9 @@ static struct command_result *do_getroutes(struct command *cmd,
581
601
}
582
602
583
603
/* Compute the routes. At this point we might select between multiple
584
- * algorithms. */
604
+ * algorithms. Right now there is only one algorithm available. */
585
605
struct timemono time_start = time_mono ();
606
+ assert (* info -> dev_algo == ALGO_DEFAULT );
586
607
err = default_routes (rq , rq , srcnode , dstnode , * info -> amount ,
587
608
/* only one path? = */
588
609
have_layer (info -> layers , "auto.no_mpp_support" ),
@@ -749,6 +770,8 @@ static struct command_result *json_getroutes(struct command *cmd,
749
770
p_req ("final_cltv" , param_u32 , & info -> finalcltv ),
750
771
p_opt_def ("maxdelay" , param_u32 , & info -> maxdelay ,
751
772
maxdelay_allowed ),
773
+ p_opt_dev ("dev_algorithm" , param_algorithm ,
774
+ & info -> dev_algo , ALGO_DEFAULT ),
752
775
NULL ))
753
776
return command_param_failed ();
754
777
0 commit comments