@@ -78,6 +78,8 @@ struct payment {
7878 struct amount_msat maxfee ;
7979 /* Maximum delay on the route we're ok with */
8080 u32 * maxdelay ;
81+ /* Maximum number of payment routes that can be pending. */
82+ u32 * maxparts ;
8183 /* Do we have to do it all in a single part? */
8284 bool disable_mpp ;
8385 /* BOLT11 payment secret (NULL for BOLT12, it uses blinded paths) */
@@ -113,6 +115,9 @@ struct payment {
113115 * call outstanding). */
114116 struct amount_msat amount_being_routed ;
115117
118+ /* Number of routes attempted and pending */
119+ u32 pending_attempts ;
120+
116121 /* Useful information from prior attempts if any. */
117122 char * prior_results ;
118123
@@ -1281,6 +1286,9 @@ static struct command_result *getroutes_for(struct command *aux_cmd,
12811286 json_add_amount_msat (req -> js , "maxfee_msat" , maxfee );
12821287 json_add_u32 (req -> js , "final_cltv" , payment -> final_cltv );
12831288 json_add_u32 (req -> js , "maxdelay" , * payment -> maxdelay );
1289+ // FIXME: deduce pending_attempts: total - failed
1290+ json_add_u32 (req -> js , "maxparts" ,
1291+ * payment -> maxparts - payment -> pending_attempts );
12841292
12851293 return send_payment_req (aux_cmd , payment , req );
12861294}
@@ -1571,6 +1579,7 @@ static struct command_result *json_xpay_core(struct command *cmd,
15711579 p_opt_def ("retry_for" , param_number , & retryfor , 60 ),
15721580 p_opt ("partial_msat" , param_msat , & partial ),
15731581 p_opt_def ("maxdelay" , param_u32 , & payment -> maxdelay , 2016 ),
1582+ p_opt_def ("maxparts" , param_u32 , & payment -> maxparts , 6 ),
15741583 NULL ))
15751584 return command_param_failed ();
15761585
@@ -1579,6 +1588,7 @@ static struct command_result *json_xpay_core(struct command *cmd,
15791588 payment -> plugin = cmd -> plugin ;
15801589 payment -> cmd = cmd ;
15811590 payment -> amount_being_routed = AMOUNT_MSAT (0 );
1591+ payment -> pending_attempts = 0 ;
15821592 payment -> group_id = pseudorand (INT64_MAX );
15831593 payment -> total_num_attempts = payment -> num_failures = 0 ;
15841594 payment -> requests = tal_arr (payment , struct out_req * , 0 );
0 commit comments