rpc: Integrate the status flow in the listsendpays command

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commit is contained in:
Vincenzo Palazzo
2021-07-20 23:08:00 +02:00
committed by Rusty Russell
parent eaec226f99
commit fd33aed4b5
8 changed files with 446 additions and 7 deletions

View File

@@ -282,7 +282,7 @@ static struct command_result *prev_payment(struct command *cmd,
bool prev_paid = false;
assert(!invreq->payer_info);
payments = wallet_payment_list(cmd, cmd->ld->wallet, NULL);
payments = wallet_payment_list(cmd, cmd->ld->wallet, NULL, NULL);
for (size_t i = 0; i < tal_count(payments); i++) {
const struct tlv_invoice *inv;

View File

@@ -860,7 +860,7 @@ send_payment_core(struct lightningd *ld,
bool have_complete = false;
/* Now, do we already have one or more payments? */
payments = wallet_payment_list(tmpctx, ld->wallet, rhash);
payments = wallet_payment_list(tmpctx, ld->wallet, rhash, NULL);
for (size_t i = 0; i < tal_count(payments); i++) {
log_debug(ld->log, "Payment %zu/%zu: %s %s",
i, tal_count(payments),
@@ -1516,12 +1516,13 @@ static struct command_result *json_listsendpays(struct command *cmd,
const struct wallet_payment **payments;
struct json_stream *response;
struct sha256 *rhash;
const char *invstring;
const char *invstring, *status_str;
if (!param(cmd, buffer, params,
/* FIXME: parameter should be invstring now */
p_opt("bolt11", param_string, &invstring),
p_opt("payment_hash", param_sha256, &rhash),
p_opt("status", param_string, &status_str),
NULL))
return command_param_failed();
@@ -1553,7 +1554,14 @@ static struct command_result *json_listsendpays(struct command *cmd,
}
}
payments = wallet_payment_list(cmd, cmd->ld->wallet, rhash);
if (status_str) {
enum wallet_payment_status status;
if (!string_to_payment_status(status_str, &status))
return command_fail(cmd, JSONRPC2_INVALID_PARAMS, "Unrecognized status: %s", status_str);
payments = wallet_payment_list(cmd, cmd->ld->wallet, rhash, &status);
} else
payments = wallet_payment_list(cmd, cmd->ld->wallet, rhash, NULL);
response = json_stream_success(cmd);
@@ -1606,7 +1614,7 @@ static struct command_result *json_delpay(struct command *cmd,
payment_status_to_string(status));
}
payments = wallet_payment_list(cmd, cmd->ld->wallet, payment_hash);
payments = wallet_payment_list(cmd, cmd->ld->wallet, payment_hash, NULL);
if (tal_count(payments) == 0)
return command_fail(cmd, PAY_NO_SUCH_PAYMENT, "Unknown payment with payment_hash: %s",

View File

@@ -4613,3 +4613,26 @@ def test_pay_low_max_htlcs(node_factory):
l1.daemon.wait_for_log(
r'Number of pre-split HTLCs \([0-9]+\) exceeds our HTLC budget \([0-9]+\), skipping pre-splitter'
)
def test_listpays_with_filter_by_status(node_factory, bitcoind):
"""
This test check if the filtering by status of the command listpays
has some mistakes.
"""
# Create the line graph l2 -> l1 with a channel of 10 ** 5 sat!
l2, l1 = node_factory.line_graph(2, fundamount=10**5, wait_for_announce=True)
inv = l1.rpc.invoice(10 ** 5, 'inv', 'inv')
l2.rpc.pay(inv['bolt11'])
wait_for(lambda: l2.rpc.listpays(inv['bolt11'])['pays'][0]['status'] == 'complete')
# test if the node is still ready
payments = l2.rpc.call("listpays", {"status": 'failed'})
assert len(payments['pays']) == 0
payments = l2.rpc.listpays()
assert len(l2.rpc.listpays()['pays']) == 1

View File

@@ -1730,6 +1730,12 @@ struct db_query db_postgres_queries[] = {
.placeholders = 1,
.readonly = true,
},
{
.name = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE status = ? ORDER BY id;",
.query = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE status = $1 ORDER BY id;",
.placeholders = 1,
.readonly = true,
},
{
.name = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments ORDER BY id;",
.query = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments ORDER BY id;",
@@ -2074,4 +2080,48 @@ struct db_query db_postgres_queries[] = {
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:d812809c7895cea0ed904084e48c523ea01a8cd9525e4b6be1b4e05bec2a90d1
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:e356b7327b760559f9a7c31a7ea4a09d50194c7aacc6daef6ba9fb5caf43ae83
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:a70af01d3b2f3a7003703b7feb0b2ef12359e0d2850bde1697a53780e2f5dbae
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:f929ee6db13bdf55b5e0cdf54840091948b664a61c63a4aaaef403dc7e6f23ad
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:219fccaaf2391eeabadd4cc15b4a3431c7ecab9d17755582e6962a34c74982c5
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:1808964024bcccbd2787e723881f263b1a77ea33c302ac2b6d61dae20486a7e4
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:411593f0957475d832c02cd75a8b0eed30b00fc6178797262ae7dd697de22383
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:be7e5cedcb61a9b96566d4531bb25f2db4e5a344b0d884eec3fc3adf7a4fe242
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:df06b800543e6bb886100ca428247ac1097f749098779dae43ba875154700f58
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:27a166e040e517422e91cf7ffbd12426b34337b8d75f82d7aa4c448beae5e821
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:6353b67b3e4f539da2d1f0c2564c4a8243f07d59cd0b73bc83d5552600bd67f7
=======
// SHA256STAMP:b5f4c156aa7e336af86f98eafc5e198d3653ff27b21d861a5e777645bf6d89ec
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command

View File

@@ -1730,6 +1730,12 @@ struct db_query db_sqlite3_queries[] = {
.placeholders = 1,
.readonly = true,
},
{
.name = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE status = ? ORDER BY id;",
.query = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE status = ? ORDER BY id;",
.placeholders = 1,
.readonly = true,
},
{
.name = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments ORDER BY id;",
.query = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments ORDER BY id;",
@@ -2074,4 +2080,48 @@ struct db_query db_sqlite3_queries[] = {
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:d812809c7895cea0ed904084e48c523ea01a8cd9525e4b6be1b4e05bec2a90d1
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:e356b7327b760559f9a7c31a7ea4a09d50194c7aacc6daef6ba9fb5caf43ae83
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:a70af01d3b2f3a7003703b7feb0b2ef12359e0d2850bde1697a53780e2f5dbae
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:f929ee6db13bdf55b5e0cdf54840091948b664a61c63a4aaaef403dc7e6f23ad
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:219fccaaf2391eeabadd4cc15b4a3431c7ecab9d17755582e6962a34c74982c5
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:1808964024bcccbd2787e723881f263b1a77ea33c302ac2b6d61dae20486a7e4
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:411593f0957475d832c02cd75a8b0eed30b00fc6178797262ae7dd697de22383
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:be7e5cedcb61a9b96566d4531bb25f2db4e5a344b0d884eec3fc3adf7a4fe242
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:df06b800543e6bb886100ca428247ac1097f749098779dae43ba875154700f58
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:27a166e040e517422e91cf7ffbd12426b34337b8d75f82d7aa4c448beae5e821
=======
<<<<<<< refs/remotes/ElementsProject/master
// SHA256STAMP:6353b67b3e4f539da2d1f0c2564c4a8243f07d59cd0b73bc83d5552600bd67f7
=======
// SHA256STAMP:b5f4c156aa7e336af86f98eafc5e198d3653ff27b21d861a5e777645bf6d89ec
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command

View File

@@ -1142,7 +1142,20 @@ msgstr ""
msgid "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;"
msgstr ""
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:3352
=======
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:3355
=======
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:3347
=======
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:3346
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
msgid "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE payment_hash = ? ORDER BY id;"
msgstr ""
@@ -1214,7 +1227,99 @@ msgstr ""
msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL"
msgstr ""
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:3780
=======
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:3783
=======
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:3775
=======
#: wallet/wallet.c:3774
=======
#: wallet/wallet.c:3341
msgid "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE payment_hash = ? ORDER BY id;"
msgstr ""
#: wallet/wallet.c:3367
msgid "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE status = ? ORDER BY id;"
msgstr ""
#: wallet/wallet.c:3390
msgid "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments ORDER BY id;"
msgstr ""
#: wallet/wallet.c:3441
msgid "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE local_offer_id = ?;"
msgstr ""
#: wallet/wallet.c:3486
msgid "DELETE FROM htlc_sigs WHERE channelid = ?"
msgstr ""
#: wallet/wallet.c:3493
msgid "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)"
msgstr ""
#: wallet/wallet.c:3505
msgid "SELECT blobval FROM vars WHERE name='genesis_hash'"
msgstr ""
#: wallet/wallet.c:3529
msgid "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);"
msgstr ""
#: wallet/wallet.c:3547
msgid "SELECT txid, outnum FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3559
msgid "DELETE FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3567 wallet/wallet.c:3681
msgid "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3586
msgid "DELETE FROM blocks WHERE hash = ?"
msgstr ""
#: wallet/wallet.c:3592
msgid "SELECT * FROM blocks WHERE height >= ?;"
msgstr ""
#: wallet/wallet.c:3601
msgid "DELETE FROM blocks WHERE height > ?"
msgstr ""
#: wallet/wallet.c:3613
msgid "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?"
msgstr ""
#: wallet/wallet.c:3631
msgid "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?"
msgstr ""
#: wallet/wallet.c:3654 wallet/wallet.c:3692
msgid "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3718
msgid "SELECT height FROM blocks WHERE height = ?"
msgstr ""
#: wallet/wallet.c:3731
msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL"
msgstr ""
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:3768
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?"
msgstr ""
@@ -1330,7 +1435,138 @@ msgstr ""
msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;"
msgstr ""
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:4717
=======
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:4720
=======
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:4712
=======
<<<<<<< refs/remotes/ElementsProject/master
#: wallet/wallet.c:4711
=======
#: wallet/wallet.c:4705
=======
#: wallet/wallet.c:3773
msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?"
msgstr ""
#: wallet/wallet.c:3804 wallet/wallet.c:3964
msgid "SELECT blockheight FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3814
msgid "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3835
msgid "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3852
msgid "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;"
msgstr ""
#: wallet/wallet.c:3884
msgid "SELECT type, channel_id FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3900
msgid "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3919
msgid "SELECT type FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3942
msgid "SELECT rawtx FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3988
msgid "SELECT blockheight, txindex FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:4016
msgid "SELECT id FROM transactions WHERE blockheight=?"
msgstr ""
#: wallet/wallet.c:4035
msgid "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4059
msgid "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;"
msgstr ""
#: wallet/wallet.c:4080
msgid "SELECT c.type, c.blockheight, t.rawtx, c.input_num, c.blockheight - t.blockheight + 1 AS depth, t.id as txid FROM channeltxs c JOIN transactions t ON t.id = c.transaction_id WHERE c.channel_id = ? ORDER BY c.id ASC;"
msgstr ""
#: wallet/wallet.c:4125
msgid "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?"
msgstr ""
#: wallet/wallet.c:4183
msgid "INSERT INTO forwarded_payments ( in_htlc_id, out_htlc_id, in_channel_scid, out_channel_scid, in_msatoshi, out_msatoshi, state, received_time, resolved_time, failcode) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4242
msgid "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;"
msgstr ""
#: wallet/wallet.c:4291
msgid "SELECT f.state, in_msatoshi, out_msatoshi, hin.payment_hash as payment_hash, in_channel_scid, out_channel_scid, f.received_time, f.resolved_time, f.failcode FROM forwarded_payments f LEFT JOIN channel_htlcs hin ON (f.in_htlc_id = hin.id) WHERE (1 = ? OR f.state = ?) AND (1 = ? OR f.in_channel_scid = ?) AND (1 = ? OR f.out_channel_scid = ?)"
msgstr ""
#: wallet/wallet.c:4413
msgid "SELECT t.id, t.rawtx, t.blockheight, t.txindex, t.type as txtype, c2.short_channel_id as txchan, a.location, a.idx as ann_idx, a.type as annotation_type, c.short_channel_id FROM transactions t LEFT JOIN transaction_annotations a ON (a.txid = t.id) LEFT JOIN channels c ON (a.channel = c.id) LEFT JOIN channels c2 ON (t.channel_id = c2.id) ORDER BY t.blockheight, t.txindex ASC"
msgstr ""
#: wallet/wallet.c:4507
msgid "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4532
msgid "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?"
msgstr ""
#: wallet/wallet.c:4556
msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?"
msgstr ""
#: wallet/wallet.c:4574
msgid "SELECT 1 FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4587
msgid "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4614
msgid "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4642
msgid "SELECT offer_id FROM offers;"
msgstr ""
#: wallet/wallet.c:4668
msgid "UPDATE offers SET status=? WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4679
msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4707
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
msgid "SELECT status FROM offers WHERE offer_id = ?;"
msgstr ""
@@ -1369,4 +1605,48 @@ msgstr ""
#: wallet/test/run-wallet.c:1712
msgid "INSERT INTO channels (id) VALUES (1);"
msgstr ""
<<<<<<< refs/remotes/ElementsProject/master
# SHA256STAMP:826f40774d133dbfa18209685ab964d2915e303346b964107ac4974275910111
=======
<<<<<<< refs/remotes/ElementsProject/master
# SHA256STAMP:0b3b17a4eb95067fdebc9d90c962c46e40fdef2002f92856cc31800ab37fbe59
=======
<<<<<<< refs/remotes/ElementsProject/master
# SHA256STAMP:651a6c15e8780351cd32a4e6dc3011b1c5fc2af6308b0e65a442dda2a3874e19
=======
<<<<<<< refs/remotes/ElementsProject/master
# SHA256STAMP:35e10cb3ec34af54b6d78d9eea1aefa0861ef9acbfe0e78745d24b8e49e50b05
=======
<<<<<<< refs/remotes/ElementsProject/master
# SHA256STAMP:d098fea63dcba84aefff5cf924cbc455caf9d2ec13cb28ad9ab929bb001a12e6
=======
<<<<<<< refs/remotes/ElementsProject/master
# SHA256STAMP:e7f23b938c7ee86b0178ca11d8d3df3f08dec52e205e0778be1f5a0b607f52f6
=======
<<<<<<< refs/remotes/ElementsProject/master
# SHA256STAMP:8878e1ee71d04ea6302c18aeb02f59c56e086a7e5a4647ddbe67bc2ef7c07275
=======
<<<<<<< refs/remotes/ElementsProject/master
# SHA256STAMP:51fa10c40312c4845f05157420486d57cc8c5ace7b7da7a92c8e496f48ff0dcc
=======
<<<<<<< refs/remotes/ElementsProject/master
# SHA256STAMP:d0ba3b9e4e392f7327662f333f4712582f7553a819d588ebb3641b229215e90f
=======
<<<<<<< refs/remotes/ElementsProject/master
# SHA256STAMP:3652b5850f08383c0f0c01a7f11c1a22ec2b4ac16018152d2770a73674fb05ec
=======
<<<<<<< refs/remotes/ElementsProject/master
# SHA256STAMP:e203d19d9f4192ad6b3aa1a6f257d4f7b267df56c5de9810b573f0affa0122fd
=======
# SHA256STAMP:e074dc48b7055c740baa4da907a743baf1048d03dca12ebd1ed5989a9b0b7549
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command
>>>>>>> rpc: Integrate the status flow in the listsendpays command

View File

@@ -3339,7 +3339,8 @@ void wallet_payment_set_failinfo(struct wallet *wallet,
const struct wallet_payment **
wallet_payment_list(const tal_t *ctx,
struct wallet *wallet,
const struct sha256 *payment_hash)
const struct sha256 *payment_hash,
enum wallet_payment_status *status)
{
const struct wallet_payment **payments;
struct db_stmt *stmt;
@@ -3371,6 +3372,32 @@ wallet_payment_list(const tal_t *ctx,
" WHERE payment_hash = ?"
" ORDER BY id;"));
db_bind_sha256(stmt, 0, payment_hash);
} else if (status) {
// TODO(vincenzopalazzo): Missing the filter options are both not null
// A possible solution is divided the string in two part (pre-where and post-where) and
// use a small if else to set the remain string, with this method we can have small code.
stmt = db_prepare_v2(wallet->db, SQL("SELECT"
" id"
", status"
", destination"
", msatoshi"
", payment_hash"
", timestamp"
", payment_preimage"
", path_secrets"
", route_nodes"
", route_channels"
", msatoshi_sent"
", description"
", bolt11"
", failonionreply"
", total_msat"
", partid"
", local_offer_id"
" FROM payments"
" WHERE status = ?"
" ORDER BY id;"));
db_bind_int(stmt, 0, wallet_payment_status_in_db(*status));
} else {
stmt = db_prepare_v2(wallet->db, SQL("SELECT"
" id"

View File

@@ -1106,7 +1106,8 @@ void wallet_payment_set_failinfo(struct wallet *wallet,
*/
const struct wallet_payment **wallet_payment_list(const tal_t *ctx,
struct wallet *wallet,
const struct sha256 *payment_hash);
const struct sha256 *payment_hash,
enum wallet_payment_status *status);
/**
* wallet_payments_by_offer - Retrieve a list of payments for this local_offer_id