@@ -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 ,
@@ -582,8 +602,9 @@ static struct command_result *do_getroutes(struct command *cmd,
582
602
}
583
603
584
604
/* Compute the routes. At this point we might select between multiple
585
- * algorithms. */
605
+ * algorithms. Right now there is only one algorithm available. */
586
606
struct timemono time_start = time_mono ();
607
+ assert (* info -> dev_algo == ALGO_DEFAULT );
587
608
err = default_routes (rq , rq , srcnode , dstnode , * info -> amount ,
588
609
/* only one path? = */
589
610
have_layer (info -> layers , "auto.no_mpp_support" ),
@@ -750,6 +771,8 @@ static struct command_result *json_getroutes(struct command *cmd,
750
771
p_req ("final_cltv" , param_u32 , & info -> finalcltv ),
751
772
p_opt_def ("maxdelay" , param_u32 , & info -> maxdelay ,
752
773
maxdelay_allowed ),
774
+ p_opt_dev ("dev_algorithm" , param_algorithm ,
775
+ & info -> dev_algo , ALGO_DEFAULT ),
753
776
NULL ))
754
777
return command_param_failed ();
755
778
0 commit comments