mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
listpays: fixed bolt11 null with keysend and update doc command
listpays: make doc-all missed Changelog-Added: JSON-RPC: `listpays` can be used to query payments using the `payment_hash` Changelog-Added: JSON-RPC: `listpays` now includes the `payment_hash`
This commit is contained in:
committed by
Christian Decker
parent
723b7223b7
commit
700897f06e
@@ -1736,7 +1736,10 @@ static void add_new_entry(struct json_stream *ret,
|
||||
const struct pay_mpp *pm)
|
||||
{
|
||||
json_object_start(ret, NULL);
|
||||
json_add_string(ret, "bolt11", pm->b11);
|
||||
if (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_u32(ret, "created_at", pm->timestamp);
|
||||
|
||||
@@ -1854,11 +1857,13 @@ static struct command_result *json_listpays(struct command *cmd,
|
||||
const jsmntok_t *params)
|
||||
{
|
||||
const char *b11str;
|
||||
struct sha256 *payment_hash;
|
||||
struct out_req *req;
|
||||
|
||||
/* FIXME: would be nice to parse as a bolt11 so check worked in future */
|
||||
if (!param(cmd, buf, params,
|
||||
p_opt("bolt11", param_string, &b11str),
|
||||
p_opt("payment_hash", param_sha256, &payment_hash),
|
||||
NULL))
|
||||
return command_param_failed();
|
||||
|
||||
@@ -1867,6 +1872,9 @@ static struct command_result *json_listpays(struct command *cmd,
|
||||
cast_const(char *, b11str));
|
||||
if (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);
|
||||
}
|
||||
|
||||
@@ -2054,7 +2062,7 @@ static const struct plugin_command commands[] = {
|
||||
}, {
|
||||
"listpays",
|
||||
"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.",
|
||||
json_listpays
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user