mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
lightning: Add status field to htlc_in
This commit is contained in:
committed by
Rusty Russell
parent
6062b40a5d
commit
a503032bab
@@ -142,6 +142,7 @@ struct htlc_in *new_htlc_in(const tal_t *ctx,
|
||||
hin->msat = msat;
|
||||
hin->cltv_expiry = cltv_expiry;
|
||||
hin->payment_hash = *payment_hash;
|
||||
hin->status = NULL;
|
||||
if (shared_secret)
|
||||
hin->shared_secret = tal_dup(hin, struct secret, shared_secret);
|
||||
else
|
||||
|
||||
@@ -55,6 +55,9 @@ struct htlc_in {
|
||||
struct secret blinding_ss;
|
||||
/* true if we supplied the preimage */
|
||||
bool *we_filled;
|
||||
|
||||
/* A simple text annotation shown in `listpeers` */
|
||||
char *status;
|
||||
};
|
||||
|
||||
struct htlc_out {
|
||||
|
||||
@@ -1068,6 +1068,8 @@ htlc_accepted_hook_final(struct htlc_accepted_hook_payload *request STEALS)
|
||||
struct htlc_in *hin = request->hin;
|
||||
struct channel *channel = request->channel;
|
||||
|
||||
request->hin->status = tal_free(request->hin->status);
|
||||
|
||||
/* *Now* we barf if it failed to decode */
|
||||
if (!request->payload) {
|
||||
log_debug(channel->log,
|
||||
|
||||
2
wallet/db_postgres_sqlgen.c
generated
2
wallet/db_postgres_sqlgen.c
generated
@@ -1924,4 +1924,4 @@ struct db_query db_postgres_queries[] = {
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
|
||||
|
||||
// SHA256STAMP:8881af1d864eeb8541b44a9dbbd48b8be848146d60ef45011e91c6e3009e9c75
|
||||
// SHA256STAMP:1379bcdee314439910fc6b238f7ec986536543c53933883ffd1b750dfc34f9b9
|
||||
|
||||
2
wallet/db_sqlite3_sqlgen.c
generated
2
wallet/db_sqlite3_sqlgen.c
generated
@@ -1924,4 +1924,4 @@ struct db_query db_sqlite3_queries[] = {
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
|
||||
|
||||
// SHA256STAMP:8881af1d864eeb8541b44a9dbbd48b8be848146d60ef45011e91c6e3009e9c75
|
||||
// SHA256STAMP:1379bcdee314439910fc6b238f7ec986536543c53933883ffd1b750dfc34f9b9
|
||||
|
||||
124
wallet/statements_gettextgen.po
generated
124
wallet/statements_gettextgen.po
generated
@@ -1010,247 +1010,247 @@ msgstr ""
|
||||
msgid "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:2449
|
||||
#: wallet/wallet.c:2450
|
||||
msgid "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, we_filled FROM channel_htlcs WHERE direction= ? AND channel_id= ? AND hstate != ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:2496
|
||||
#: wallet/wallet.c:2497
|
||||
msgid "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, partid, localfailmsg FROM channel_htlcs WHERE direction = ? AND channel_id = ? AND hstate != ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:2627
|
||||
#: wallet/wallet.c:2628
|
||||
msgid "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:2661
|
||||
#: wallet/wallet.c:2662
|
||||
msgid "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:2714
|
||||
#: wallet/wallet.c:2715
|
||||
msgid "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:2732
|
||||
#: wallet/wallet.c:2733
|
||||
msgid "INSERT INTO payments ( status, payment_hash, destination, msatoshi, timestamp, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, total_msat, partid, local_offer_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:2821
|
||||
#: wallet/wallet.c:2822
|
||||
msgid "DELETE FROM payments WHERE payment_hash = ? AND partid = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:2835
|
||||
#: wallet/wallet.c:2836
|
||||
msgid "DELETE FROM payments WHERE payment_hash = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:2936
|
||||
#: wallet/wallet.c:2937
|
||||
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 = ? AND partid = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:2986
|
||||
#: wallet/wallet.c:2987
|
||||
msgid "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:2996
|
||||
#: wallet/wallet.c:2997
|
||||
msgid "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3006
|
||||
#: wallet/wallet.c:3007
|
||||
msgid "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3038
|
||||
#: wallet/wallet.c:3039
|
||||
msgid "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3105
|
||||
#: wallet/wallet.c:3106
|
||||
msgid "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3164
|
||||
#: wallet/wallet.c:3165
|
||||
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:3187
|
||||
#: wallet/wallet.c:3188
|
||||
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:3238
|
||||
#: wallet/wallet.c:3239
|
||||
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:3283
|
||||
#: wallet/wallet.c:3284
|
||||
msgid "DELETE FROM htlc_sigs WHERE channelid = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3290
|
||||
#: wallet/wallet.c:3291
|
||||
msgid "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3302
|
||||
#: wallet/wallet.c:3303
|
||||
msgid "SELECT blobval FROM vars WHERE name='genesis_hash'"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3326
|
||||
#: wallet/wallet.c:3327
|
||||
msgid "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3344
|
||||
#: wallet/wallet.c:3345
|
||||
msgid "SELECT txid, outnum FROM utxoset WHERE spendheight < ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3356
|
||||
#: wallet/wallet.c:3357
|
||||
msgid "DELETE FROM utxoset WHERE spendheight < ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3364 wallet/wallet.c:3478
|
||||
#: wallet/wallet.c:3365 wallet/wallet.c:3479
|
||||
msgid "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3383
|
||||
#: wallet/wallet.c:3384
|
||||
msgid "DELETE FROM blocks WHERE hash = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3389
|
||||
#: wallet/wallet.c:3390
|
||||
msgid "SELECT * FROM blocks WHERE height >= ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3398
|
||||
#: wallet/wallet.c:3399
|
||||
msgid "DELETE FROM blocks WHERE height > ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3410
|
||||
#: wallet/wallet.c:3411
|
||||
msgid "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3428
|
||||
#: wallet/wallet.c:3429
|
||||
msgid "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3451 wallet/wallet.c:3489
|
||||
#: wallet/wallet.c:3452 wallet/wallet.c:3490
|
||||
msgid "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3515
|
||||
#: wallet/wallet.c:3516
|
||||
msgid "SELECT height FROM blocks WHERE height = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3528
|
||||
#: wallet/wallet.c:3529
|
||||
msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3570
|
||||
#: wallet/wallet.c:3571
|
||||
msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3601 wallet/wallet.c:3761
|
||||
#: wallet/wallet.c:3602 wallet/wallet.c:3762
|
||||
msgid "SELECT blockheight FROM transactions WHERE id=?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3611
|
||||
#: wallet/wallet.c:3612
|
||||
msgid "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3632
|
||||
#: wallet/wallet.c:3633
|
||||
msgid "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3649
|
||||
#: wallet/wallet.c:3650
|
||||
msgid "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3681
|
||||
#: wallet/wallet.c:3682
|
||||
msgid "SELECT type, channel_id FROM transactions WHERE id=?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3697
|
||||
#: wallet/wallet.c:3698
|
||||
msgid "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3716
|
||||
#: wallet/wallet.c:3717
|
||||
msgid "SELECT type FROM transactions WHERE id=?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3739
|
||||
#: wallet/wallet.c:3740
|
||||
msgid "SELECT rawtx FROM transactions WHERE id=?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3785
|
||||
#: wallet/wallet.c:3786
|
||||
msgid "SELECT blockheight, txindex FROM transactions WHERE id=?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3813
|
||||
#: wallet/wallet.c:3814
|
||||
msgid "SELECT id FROM transactions WHERE blockheight=?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3832
|
||||
#: wallet/wallet.c:3833
|
||||
msgid "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3856
|
||||
#: wallet/wallet.c:3857
|
||||
msgid "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3877
|
||||
#: wallet/wallet.c:3878
|
||||
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:3922
|
||||
#: wallet/wallet.c:3923
|
||||
msgid "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:3980
|
||||
#: wallet/wallet.c:3981
|
||||
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:4039
|
||||
#: wallet/wallet.c:4040
|
||||
msgid "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:4088
|
||||
#: wallet/wallet.c:4089
|
||||
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:4210
|
||||
#: wallet/wallet.c:4211
|
||||
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:4304
|
||||
#: wallet/wallet.c:4305
|
||||
msgid "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:4329
|
||||
#: wallet/wallet.c:4330
|
||||
msgid "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:4353
|
||||
#: wallet/wallet.c:4354
|
||||
msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:4371
|
||||
#: wallet/wallet.c:4372
|
||||
msgid "SELECT 1 FROM offers WHERE offer_id = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:4384
|
||||
#: wallet/wallet.c:4385
|
||||
msgid "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:4411
|
||||
#: wallet/wallet.c:4412
|
||||
msgid "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:4439
|
||||
#: wallet/wallet.c:4440
|
||||
msgid "SELECT offer_id FROM offers;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:4465
|
||||
#: wallet/wallet.c:4466
|
||||
msgid "UPDATE offers SET status=? WHERE offer_id = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:4476
|
||||
#: wallet/wallet.c:4477
|
||||
msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/wallet.c:4504
|
||||
#: wallet/wallet.c:4505
|
||||
msgid "SELECT status FROM offers WHERE offer_id = ?;"
|
||||
msgstr ""
|
||||
|
||||
@@ -1269,4 +1269,4 @@ msgstr ""
|
||||
#: wallet/test/run-wallet.c:1649
|
||||
msgid "INSERT INTO channels (id) VALUES (1);"
|
||||
msgstr ""
|
||||
# SHA256STAMP:16bc289317e93dbae2af010cde394060c0d5cbf610e5fcb995d6fa5ad4587bf1
|
||||
# SHA256STAMP:51de0bd1efd4b12ec550d3faf934a32f745018a46e61b50cc242c2d5bae09470
|
||||
|
||||
@@ -2271,6 +2271,7 @@ static bool wallet_stmt2htlc_in(struct channel *channel,
|
||||
db_column_amount_msat(stmt, 2, &in->msat);
|
||||
in->cltv_expiry = db_column_int(stmt, 3);
|
||||
in->hstate = db_column_int(stmt, 4);
|
||||
in->status = NULL;
|
||||
/* FIXME: save blinding in db !*/
|
||||
in->blinding = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user