@ -1736,7 +1736,10 @@ static void add_new_entry(struct json_stream *ret,
const struct pay_mpp * pm )
const struct pay_mpp * pm )
{
{
json_object_start ( ret , NULL ) ;
json_object_start ( ret , NULL ) ;
if ( pm - > b11 )
json_add_string ( ret , " bolt11 " , pm - > b11 ) ;
json_add_string ( ret , " bolt11 " , pm - > b11 ) ;
json_add_sha256 ( ret , " payment_hash " , pm - > payment_hash ) ;
json_add_string ( ret , " status " , pm - > status ) ;
json_add_string ( ret , " status " , pm - > status ) ;
json_add_u32 ( ret , " created_at " , pm - > timestamp ) ;
json_add_u32 ( ret , " created_at " , pm - > timestamp ) ;
@ -1854,11 +1857,13 @@ static struct command_result *json_listpays(struct command *cmd,
const jsmntok_t * params )
const jsmntok_t * params )
{
{
const char * b11str ;
const char * b11str ;
struct sha256 * payment_hash ;
struct out_req * req ;
struct out_req * req ;
/* FIXME: would be nice to parse as a bolt11 so check worked in future */
/* FIXME: would be nice to parse as a bolt11 so check worked in future */
if ( ! param ( cmd , buf , params ,
if ( ! param ( cmd , buf , params ,
p_opt ( " bolt11 " , param_string , & b11str ) ,
p_opt ( " bolt11 " , param_string , & b11str ) ,
p_opt ( " payment_hash " , param_sha256 , & payment_hash ) ,
NULL ) )
NULL ) )
return command_param_failed ( ) ;
return command_param_failed ( ) ;
@ -1867,6 +1872,9 @@ static struct command_result *json_listpays(struct command *cmd,
cast_const ( char * , b11str ) ) ;
cast_const ( char * , b11str ) ) ;
if ( b11str )
if ( b11str )
json_add_string ( req - > js , " bolt11 " , b11str ) ;
json_add_string ( req - > js , " bolt11 " , b11str ) ;
if ( payment_hash )
json_add_sha256 ( req - > js , " payment_hash " , payment_hash ) ;
return send_outreq ( cmd - > plugin , req ) ;
return send_outreq ( cmd - > plugin , req ) ;
}
}
@ -2054,7 +2062,7 @@ static const struct plugin_command commands[] = {
} , {
} , {
" listpays " ,
" listpays " ,
" payment " ,
" payment " ,
" List result of payment {bolt11}, or all " ,
" List result of payment {bolt11} or {payment_hash} , or all " ,
" Covers old payments (failed and succeeded) and current ones. " ,
" Covers old payments (failed and succeeded) and current ones. " ,
json_listpays
json_listpays
} ,
} ,