Skip to content

Commit

Permalink
plugin: Adding status to the pay plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo committed Aug 13, 2021
1 parent 94eb9e3 commit 7a6817c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 75 deletions.
5 changes: 3 additions & 2 deletions contrib/pyln-client/pyln/client/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,11 +954,12 @@ def listpeers(self, peerid=None, level=None):
}
return self.call("listpeers", payload)

def listsendpays(self, bolt11=None, payment_hash=None):
def listsendpays(self, bolt11=None, payment_hash=None, status=None):
"""Show all sendpays results, or only for `bolt11` or `payment_hash`."""
payload = {
"bolt11": bolt11,
"payment_hash": payment_hash
"payment_hash": payment_hash,
"status": status
}
return self.call("listsendpays", payload)

Expand Down
6 changes: 3 additions & 3 deletions doc/lightning-listsendpays.7

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions doc/lightning-listsendpays.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ lightning-listsendpays -- Low-level command for querying sendpay status
SYNOPSIS
--------

**listsendpays** \[*bolt11*\] \[*payment\_hash*\]
**listsendpays** \[*bolt11*\] \[*payment\_hash*\] [\*status*\]

DESCRIPTION
-----------

The **listsendpays** RPC command gets the status of all *sendpay*
commands (which is also used by the *pay* command), or with *bolt11* or
*payment\_hash* limits results to that specific payment. You cannot
specify both.
specify both. It is possible filter the payments also by status.

Note that in future there may be more than one concurrent *sendpay*
command per *pay*, so this command should be used with caution.
Expand Down
2 changes: 1 addition & 1 deletion external/lnprototest
5 changes: 4 additions & 1 deletion plugins/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1905,7 +1905,7 @@ static struct command_result *json_listpays(struct command *cmd,
const char *buf,
const jsmntok_t *params)
{
const char *invstring;
const char *invstring, *status_str;
struct sha256 *payment_hash;
struct out_req *req;

Expand All @@ -1914,6 +1914,7 @@ static struct command_result *json_listpays(struct command *cmd,
/* FIXME: parameter should be invstring now */
p_opt("bolt11", param_string, &invstring),
p_opt("payment_hash", param_sha256, &payment_hash),
p_opt("status", param_string, &status_str),
NULL))
return command_param_failed();

Expand All @@ -1926,6 +1927,8 @@ static struct command_result *json_listpays(struct command *cmd,
if (payment_hash)
json_add_sha256(req->js, "payment_hash", payment_hash);

if (status_str)
json_add_string(req->js, "status", status_str);
return send_outreq(cmd->plugin, req);
}

Expand Down
23 changes: 1 addition & 22 deletions wallet/db_postgres_sqlgen.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 1 addition & 22 deletions wallet/db_sqlite3_sqlgen.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 1 addition & 22 deletions wallet/statements_gettextgen.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7a6817c

Please sign in to comment.