@@ -1912,6 +1912,9 @@ static struct command_result *handle_rpc_command(struct command *cmd,
19121912 const char * maxfee = NULL ;
19131913 struct json_stream * response ;
19141914
1915+ /* pay extra params */
1916+ const jsmntok_t * maxfeepercent = NULL , * exemptfee = NULL ;
1917+
19151918 if (!xpay -> take_over_pay )
19161919 goto dont_redirect ;
19171920
@@ -1945,7 +1948,7 @@ static struct command_result *handle_rpc_command(struct command *cmd,
19451948 if (amount_msat && json_tok_is_null (buf , amount_msat ))
19461949 amount_msat = NULL ;
19471950 } else if (params_tok -> type == JSMN_OBJECT ) {
1948- const jsmntok_t * t , * maxfeepercent = NULL , * exemptfee = NULL ;
1951+ const jsmntok_t * t ;
19491952 size_t i ;
19501953
19511954 json_for_each_obj (i , t , params_tok ) {
@@ -1973,25 +1976,25 @@ static struct command_result *handle_rpc_command(struct command *cmd,
19731976 goto dont_redirect ;
19741977 }
19751978 }
1976- if (!bolt11 ) {
1977- plugin_log (cmd -> plugin , LOG_INFORM ,
1978- "Not redirecting pay (missing bolt11 parameter)" );
1979- goto dont_redirect ;
1980- }
1981- /* If this returns NULL, we let pay handle the weird case */
1982- if (!calc_maxfee (cmd , & maxfee , buf ,
1983- bolt11 , amount_msat ,
1984- exemptfee , maxfeepercent )) {
1985- plugin_log (cmd -> plugin , LOG_INFORM ,
1986- "Not redirecting pay (weird maxfee params)" );
1987- goto dont_redirect ;
1988- }
19891979 } else {
19901980 plugin_log (cmd -> plugin , LOG_INFORM ,
19911981 "Not redirecting pay (unexpected params type)" );
19921982 goto dont_redirect ;
19931983 }
19941984
1985+ if (!bolt11 ) {
1986+ plugin_log (cmd -> plugin , LOG_INFORM ,
1987+ "Not redirecting pay (missing bolt11 parameter)" );
1988+ goto dont_redirect ;
1989+ }
1990+ /* If this returns NULL, we let pay handle the weird case */
1991+ if (!calc_maxfee (cmd , & maxfee , buf , bolt11 , amount_msat , exemptfee ,
1992+ maxfeepercent )) {
1993+ plugin_log (cmd -> plugin , LOG_INFORM ,
1994+ "Not redirecting pay (weird maxfee params)" );
1995+ goto dont_redirect ;
1996+ }
1997+
19951998 plugin_log (cmd -> plugin , LOG_INFORM , "Redirecting pay->xpay" );
19961999 response = jsonrpc_stream_success (cmd );
19972000 json_object_start (response , "replace" );
0 commit comments