Skip to content

Commit 9d5c992

Browse files
vincenzopalazzorustyrussell
authored andcommitted
plugin: Adding status to the pay plugin
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> Rebase Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
1 parent 62ef403 commit 9d5c992

File tree

8 files changed

+172
-70
lines changed

8 files changed

+172
-70
lines changed

contrib/pyln-client/pyln/client/lightning.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,11 +955,12 @@ def listpeers(self, peerid=None, level=None):
955955
}
956956
return self.call("listpeers", payload)
957957

958-
def listsendpays(self, bolt11=None, payment_hash=None):
958+
def listsendpays(self, bolt11=None, payment_hash=None, status=None):
959959
"""Show all sendpays results, or only for `bolt11` or `payment_hash`."""
960960
payload = {
961961
"bolt11": bolt11,
962-
"payment_hash": payment_hash
962+
"payment_hash": payment_hash,
963+
"status": status
963964
}
964965
return self.call("listsendpays", payload)
965966

doc/lightning-listpays.7

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/lightning-listsendpays.7

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/lightning-listsendpays.7.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ lightning-listsendpays -- Low-level command for querying sendpay status
44
SYNOPSIS
55
--------
66

7-
**listsendpays** \[*bolt11*\] \[*payment\_hash*\]
7+
**listsendpays** \[*bolt11*\] \[*payment\_hash*\] [\*status*\]
88

99
DESCRIPTION
1010
-----------
1111

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

1717
Note that in future there may be more than one concurrent *sendpay*
1818
command per *pay*, so this command should be used with caution.

plugins/pay.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,7 @@ static struct command_result *json_listpays(struct command *cmd,
18941894
const char *buf,
18951895
const jsmntok_t *params)
18961896
{
1897-
const char *invstring;
1897+
const char *invstring, *status_str;
18981898
struct sha256 *payment_hash;
18991899
struct out_req *req;
19001900

@@ -1903,6 +1903,7 @@ static struct command_result *json_listpays(struct command *cmd,
19031903
/* FIXME: parameter should be invstring now */
19041904
p_opt("bolt11", param_string, &invstring),
19051905
p_opt("payment_hash", param_sha256, &payment_hash),
1906+
p_opt("status", param_string, &status_str),
19061907
NULL))
19071908
return command_param_failed();
19081909

@@ -1915,6 +1916,8 @@ static struct command_result *json_listpays(struct command *cmd,
19151916
if (payment_hash)
19161917
json_add_sha256(req->js, "payment_hash", payment_hash);
19171918

1919+
if (status_str)
1920+
json_add_string(req->js, "status", status_str);
19181921
return send_outreq(cmd->plugin, req);
19191922
}
19201923

wallet/db_postgres_sqlgen.c

Lines changed: 20 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wallet/db_sqlite3_sqlgen.c

Lines changed: 20 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)