rbf: when a channel is open, remove all the inflights

The channel's open has been mined, we don't need to keep all of these around
now.
This commit is contained in:
niftynei
2021-05-20 16:52:42 -05:00
committed by Rusty Russell
parent 062bc12813
commit d04c373283
6 changed files with 145 additions and 102 deletions

View File

@@ -1544,6 +1544,9 @@ static void handle_channel_locked(struct subd *dualopend,
"Lockin complete");
channel_record_open(channel);
/* Empty out the inflights */
wallet_channel_clear_inflights(dualopend->ld->wallet, channel);
/* FIXME: LND sigs/update_fee msgs? */
peer_start_channeld(channel, pps, NULL, false);
return;

View File

@@ -1286,6 +1286,12 @@ struct db_query db_postgres_queries[] = {
.placeholders = 5,
.readonly = false,
},
{
.name = "DELETE FROM channel_funding_inflights WHERE channel_id = ?",
.query = "DELETE FROM channel_funding_inflights WHERE channel_id = $1",
.placeholders = 1,
.readonly = false,
},
{
.name = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate",
.query = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received FROM channel_funding_inflights WHERE channel_id = $1 ORDER BY funding_feerate",
@@ -1894,10 +1900,10 @@ struct db_query db_postgres_queries[] = {
},
};
#define DB_POSTGRES_QUERY_COUNT 314
#define DB_POSTGRES_QUERY_COUNT 315
#endif /* HAVE_POSTGRES */
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
// SHA256STAMP:afab339ef2b9f164d7cf2e71a19f6c000779e6334f348ddf4720176100cf6de8
// SHA256STAMP:3e9e616dd7902bee25e0b17b878a60e57a7a8c9bfec2376b4efe7c4094ffe617

View File

@@ -1286,6 +1286,12 @@ struct db_query db_sqlite3_queries[] = {
.placeholders = 5,
.readonly = false,
},
{
.name = "DELETE FROM channel_funding_inflights WHERE channel_id = ?",
.query = "DELETE FROM channel_funding_inflights WHERE channel_id = ?",
.placeholders = 1,
.readonly = false,
},
{
.name = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate",
.query = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate",
@@ -1894,10 +1900,10 @@ struct db_query db_sqlite3_queries[] = {
},
};
#define DB_SQLITE3_QUERY_COUNT 314
#define DB_SQLITE3_QUERY_COUNT 315
#endif /* HAVE_SQLITE3 */
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
// SHA256STAMP:afab339ef2b9f164d7cf2e71a19f6c000779e6334f348ddf4720176100cf6de8
// SHA256STAMP:3e9e616dd7902bee25e0b17b878a60e57a7a8c9bfec2376b4efe7c4094ffe617

View File

@@ -850,391 +850,395 @@ msgstr ""
msgid "UPDATE channel_funding_inflights SET funding_psbt=?, funding_tx_remote_sigs_received=? WHERE channel_id=? AND funding_tx_id=? AND funding_tx_outnum=?"
msgstr ""
#: wallet/wallet.c:1041
#: wallet/wallet.c:1011
msgid "DELETE FROM channel_funding_inflights WHERE channel_id = ?"
msgstr ""
#: wallet/wallet.c:1059
msgid "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate"
msgstr ""
#: wallet/wallet.c:1270
#: wallet/wallet.c:1288
msgid "SELECT id FROM channels ORDER BY id DESC LIMIT 1;"
msgstr ""
#: wallet/wallet.c:1287
#: wallet/wallet.c:1305
msgid "SELECT id, peer_id, short_channel_id, full_channel_id, channel_config_local, channel_config_remote, state, funder, channel_flags, minimum_depth, next_index_local, next_index_remote, next_htlc_id, funding_tx_id, funding_tx_outnum, funding_satoshi, our_funding_satoshi, funding_locked_remote, push_msatoshi, msatoshi_local, fundingkey_remote, revocation_basepoint_remote, payment_basepoint_remote, htlc_basepoint_remote, delayed_payment_basepoint_remote, per_commit_remote, old_per_commit_remote, local_feerate_per_kw, remote_feerate_per_kw, shachain_remote_id, shutdown_scriptpubkey_remote, shutdown_keyidx_local, last_sent_commit_state, last_sent_commit_id, last_tx, last_sig, last_was_revoke, first_blocknum, min_possible_feerate, max_possible_feerate, msatoshi_to_us_min, msatoshi_to_us_max, future_per_commitment_point, last_sent_commit, feerate_base, feerate_ppm, remote_upfront_shutdown_script, option_static_remotekey, option_anchor_outputs, shutdown_scriptpubkey_local, closer, state_change_reason, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local, shutdown_wrong_txid, shutdown_wrong_outnum FROM channels WHERE state != ?;"
msgstr ""
#: wallet/wallet.c:1385
#: wallet/wallet.c:1403
msgid "UPDATE channels SET in_payments_offered = COALESCE(in_payments_offered, 0) + 1 , in_msatoshi_offered = COALESCE(in_msatoshi_offered, 0) + ? WHERE id = ?;"
msgstr ""
#: wallet/wallet.c:1390
#: wallet/wallet.c:1408
msgid "UPDATE channels SET in_payments_fulfilled = COALESCE(in_payments_fulfilled, 0) + 1 , in_msatoshi_fulfilled = COALESCE(in_msatoshi_fulfilled, 0) + ? WHERE id = ?;"
msgstr ""
#: wallet/wallet.c:1395
#: wallet/wallet.c:1413
msgid "UPDATE channels SET out_payments_offered = COALESCE(out_payments_offered, 0) + 1 , out_msatoshi_offered = COALESCE(out_msatoshi_offered, 0) + ? WHERE id = ?;"
msgstr ""
#: wallet/wallet.c:1400
#: wallet/wallet.c:1418
msgid "UPDATE channels SET out_payments_fulfilled = COALESCE(out_payments_fulfilled, 0) + 1 , out_msatoshi_fulfilled = COALESCE(out_msatoshi_fulfilled, 0) + ? WHERE id = ?;"
msgstr ""
#: wallet/wallet.c:1442
#: wallet/wallet.c:1460
msgid "SELECT in_payments_offered, in_payments_fulfilled, in_msatoshi_offered, in_msatoshi_fulfilled, out_payments_offered, out_payments_fulfilled, out_msatoshi_offered, out_msatoshi_fulfilled FROM channels WHERE id = ?"
msgstr ""
#: wallet/wallet.c:1471
#: wallet/wallet.c:1489
msgid "SELECT MIN(height), MAX(height) FROM blocks;"
msgstr ""
#: wallet/wallet.c:1493
#: wallet/wallet.c:1511
msgid "INSERT INTO channel_configs DEFAULT VALUES;"
msgstr ""
#: wallet/wallet.c:1505
#: wallet/wallet.c:1523
msgid "UPDATE channel_configs SET dust_limit_satoshis=?, max_htlc_value_in_flight_msat=?, channel_reserve_satoshis=?, htlc_minimum_msat=?, to_self_delay=?, max_accepted_htlcs=? WHERE id=?;"
msgstr ""
#: wallet/wallet.c:1529
#: wallet/wallet.c:1547
msgid "SELECT id, dust_limit_satoshis, max_htlc_value_in_flight_msat, channel_reserve_satoshis, htlc_minimum_msat, to_self_delay, max_accepted_htlcs FROM channel_configs WHERE id= ? ;"
msgstr ""
#: wallet/wallet.c:1563
#: wallet/wallet.c:1581
msgid "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1582
#: wallet/wallet.c:1600
msgid "UPDATE channels SET shachain_remote_id=?, short_channel_id=?, full_channel_id=?, state=?, funder=?, channel_flags=?, minimum_depth=?, next_index_local=?, next_index_remote=?, next_htlc_id=?, funding_tx_id=?, funding_tx_outnum=?, funding_satoshi=?, our_funding_satoshi=?, funding_locked_remote=?, push_msatoshi=?, msatoshi_local=?, shutdown_scriptpubkey_remote=?, shutdown_keyidx_local=?, channel_config_local=?, last_tx=?, last_sig=?, last_was_revoke=?, min_possible_feerate=?, max_possible_feerate=?, msatoshi_to_us_min=?, msatoshi_to_us_max=?, feerate_base=?, feerate_ppm=?, remote_upfront_shutdown_script=?, option_static_remotekey=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1674
#: wallet/wallet.c:1692
msgid "UPDATE channels SET fundingkey_remote=?, revocation_basepoint_remote=?, payment_basepoint_remote=?, htlc_basepoint_remote=?, delayed_payment_basepoint_remote=?, per_commit_remote=?, old_per_commit_remote=?, channel_config_remote=?, future_per_commitment_point=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1701
#: wallet/wallet.c:1719
msgid "DELETE FROM channel_feerates WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1711
#: wallet/wallet.c:1729
msgid "INSERT INTO channel_feerates VALUES(?, ?, ?)"
msgstr ""
#: wallet/wallet.c:1728
#: wallet/wallet.c:1746
msgid "UPDATE channels SET last_sent_commit=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1751
#: wallet/wallet.c:1769
msgid "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:1779
#: wallet/wallet.c:1797
msgid "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;"
msgstr ""
#: wallet/wallet.c:1808
#: wallet/wallet.c:1826
msgid "SELECT id FROM peers WHERE node_id = ?"
msgstr ""
#: wallet/wallet.c:1820
#: wallet/wallet.c:1838
msgid "UPDATE peers SET address = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:1829
#: wallet/wallet.c:1847
msgid "INSERT INTO peers (node_id, address) VALUES (?, ?);"
msgstr ""
#: wallet/wallet.c:1850
#: wallet/wallet.c:1868
msgid "INSERT INTO channels ( peer_id, first_blocknum, id, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local) VALUES (?, ?, ?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:1891
#: wallet/wallet.c:1909
msgid "DELETE FROM channel_htlcs WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1897
#: wallet/wallet.c:1915
msgid "DELETE FROM htlc_sigs WHERE channelid=?"
msgstr ""
#: wallet/wallet.c:1903
#: wallet/wallet.c:1921
msgid "DELETE FROM channeltxs WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1910
#: wallet/wallet.c:1928
msgid "DELETE FROM channel_funding_inflights WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1916
#: wallet/wallet.c:1934
msgid "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)"
msgstr ""
#: wallet/wallet.c:1926
#: wallet/wallet.c:1944
msgid "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?"
msgstr ""
#: wallet/wallet.c:1940
#: wallet/wallet.c:1958
msgid "SELECT * FROM channels WHERE peer_id = ?;"
msgstr ""
#: wallet/wallet.c:1948
#: wallet/wallet.c:1966
msgid "DELETE FROM peers WHERE id=?"
msgstr ""
#: wallet/wallet.c:1959
#: wallet/wallet.c:1977
msgid "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?"
msgstr ""
#: wallet/wallet.c:2062
#: wallet/wallet.c:2080
msgid "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, shared_secret, routing_onion, received_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:2115
#: wallet/wallet.c:2133
msgid "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, origin_htlc, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, routing_onion, malformed_onion, partid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?);"
msgstr ""
#: wallet/wallet.c:2176
#: wallet/wallet.c:2194
msgid "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:2392
#: wallet/wallet.c:2410
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:2439
#: wallet/wallet.c:2457
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:2570
#: wallet/wallet.c:2588
msgid "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;"
msgstr ""
#: wallet/wallet.c:2604
#: wallet/wallet.c:2622
msgid "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2657
#: wallet/wallet.c:2675
msgid "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2675
#: wallet/wallet.c:2693
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:2764
#: wallet/wallet.c:2782
msgid "DELETE FROM payments WHERE payment_hash = ? AND partid = ?"
msgstr ""
#: wallet/wallet.c:2778
#: wallet/wallet.c:2796
msgid "DELETE FROM payments WHERE payment_hash = ?"
msgstr ""
#: wallet/wallet.c:2879
#: wallet/wallet.c:2897
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:2929
#: wallet/wallet.c:2947
msgid "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?"
msgstr ""
#: wallet/wallet.c:2939
#: wallet/wallet.c:2957
msgid "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?"
msgstr ""
#: wallet/wallet.c:2949
#: wallet/wallet.c:2967
msgid "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2981
#: wallet/wallet.c:2999
msgid "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;"
msgstr ""
#: wallet/wallet.c:3048
#: wallet/wallet.c:3066
msgid "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;"
msgstr ""
#: wallet/wallet.c:3107
#: wallet/wallet.c:3125
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 = ?;"
msgstr ""
#: wallet/wallet.c:3129
#: wallet/wallet.c:3147
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:3180
#: wallet/wallet.c:3198
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:3225
#: wallet/wallet.c:3243
msgid "DELETE FROM htlc_sigs WHERE channelid = ?"
msgstr ""
#: wallet/wallet.c:3232
#: wallet/wallet.c:3250
msgid "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)"
msgstr ""
#: wallet/wallet.c:3244
#: wallet/wallet.c:3262
msgid "SELECT blobval FROM vars WHERE name='genesis_hash'"
msgstr ""
#: wallet/wallet.c:3268
#: wallet/wallet.c:3286
msgid "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);"
msgstr ""
#: wallet/wallet.c:3286
#: wallet/wallet.c:3304
msgid "SELECT txid, outnum FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3298
#: wallet/wallet.c:3316
msgid "DELETE FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3306 wallet/wallet.c:3420
#: wallet/wallet.c:3324 wallet/wallet.c:3438
msgid "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3325
#: wallet/wallet.c:3343
msgid "DELETE FROM blocks WHERE hash = ?"
msgstr ""
#: wallet/wallet.c:3331
#: wallet/wallet.c:3349
msgid "SELECT * FROM blocks WHERE height >= ?;"
msgstr ""
#: wallet/wallet.c:3340
#: wallet/wallet.c:3358
msgid "DELETE FROM blocks WHERE height > ?"
msgstr ""
#: wallet/wallet.c:3352
#: wallet/wallet.c:3370
msgid "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?"
msgstr ""
#: wallet/wallet.c:3370
#: wallet/wallet.c:3388
msgid "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?"
msgstr ""
#: wallet/wallet.c:3393 wallet/wallet.c:3431
#: wallet/wallet.c:3411 wallet/wallet.c:3449
msgid "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3457
#: wallet/wallet.c:3475
msgid "SELECT height FROM blocks WHERE height = ?"
msgstr ""
#: wallet/wallet.c:3470
#: wallet/wallet.c:3488
msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL"
msgstr ""
#: wallet/wallet.c:3512
#: wallet/wallet.c:3530
msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?"
msgstr ""
#: wallet/wallet.c:3543 wallet/wallet.c:3703
#: wallet/wallet.c:3561 wallet/wallet.c:3721
msgid "SELECT blockheight FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3553
#: wallet/wallet.c:3571
msgid "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3574
#: wallet/wallet.c:3592
msgid "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3591
#: wallet/wallet.c:3609
msgid "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;"
msgstr ""
#: wallet/wallet.c:3623
#: wallet/wallet.c:3641
msgid "SELECT type, channel_id FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3639
#: wallet/wallet.c:3657
msgid "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3658
#: wallet/wallet.c:3676
msgid "SELECT type FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3681
#: wallet/wallet.c:3699
msgid "SELECT rawtx FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3727
#: wallet/wallet.c:3745
msgid "SELECT blockheight, txindex FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3755
#: wallet/wallet.c:3773
msgid "SELECT id FROM transactions WHERE blockheight=?"
msgstr ""
#: wallet/wallet.c:3774
#: wallet/wallet.c:3792
msgid "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3798
#: wallet/wallet.c:3816
msgid "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;"
msgstr ""
#: wallet/wallet.c:3819
#: wallet/wallet.c:3837
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:3864
#: wallet/wallet.c:3882
msgid "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?"
msgstr ""
#: wallet/wallet.c:3922
#: wallet/wallet.c:3940
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:3981
#: wallet/wallet.c:3999
msgid "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;"
msgstr ""
#: wallet/wallet.c:4030
#: wallet/wallet.c:4048
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:4152
#: wallet/wallet.c:4170
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:4246
#: wallet/wallet.c:4264
msgid "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4271
#: wallet/wallet.c:4289
msgid "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?"
msgstr ""
#: wallet/wallet.c:4295
#: wallet/wallet.c:4313
msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?"
msgstr ""
#: wallet/wallet.c:4313
#: wallet/wallet.c:4331
msgid "SELECT 1 FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4326
#: wallet/wallet.c:4344
msgid "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4353
#: wallet/wallet.c:4371
msgid "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4381
#: wallet/wallet.c:4399
msgid "SELECT offer_id FROM offers;"
msgstr ""
#: wallet/wallet.c:4407
#: wallet/wallet.c:4425
msgid "UPDATE offers SET status=? WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4418
#: wallet/wallet.c:4436
msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4446
#: wallet/wallet.c:4464
msgid "SELECT status FROM offers WHERE offer_id = ?;"
msgstr ""
@@ -1253,4 +1257,4 @@ msgstr ""
#: wallet/test/run-wallet.c:1647
msgid "INSERT INTO channels (id) VALUES (1);"
msgstr ""
# SHA256STAMP:31b48bebfb4b2c1eef0c740313068f0c129170852a3ae75c76ebfa5a546be219
# SHA256STAMP:78ef666d4e867ffdef1d84235050b0a6dc2c6f0c16a3b2703cd70c80e266f543

View File

@@ -1001,6 +1001,24 @@ void wallet_inflight_save(struct wallet *w,
db_exec_prepared_v2(take(stmt));
}
void wallet_channel_clear_inflights(struct wallet *w,
struct channel *chan)
{
struct db_stmt *stmt;
struct channel_inflight *inflight;
/* Remove all the inflights for the channel */
stmt = db_prepare_v2(w->db, SQL("DELETE FROM channel_funding_inflights"
" WHERE channel_id = ?"));
db_bind_u64(stmt, 0, chan->dbid);
db_exec_prepared_v2(take(stmt));
/* Empty out the list too */
while ((inflight = list_tail(&chan->inflights,
struct channel_inflight, list)))
tal_free(inflight);
}
static struct channel_inflight *
wallet_stmt2inflight(struct wallet *w, struct db_stmt *stmt,
struct channel *chan)

View File

@@ -520,6 +520,12 @@ void wallet_inflight_add(struct wallet *w, struct channel_inflight *inflight);
void wallet_inflight_save(struct wallet *w,
struct channel_inflight *inflight);
/**
* Remove all the inflights from a channel. Also cleans up
* the channel's inflight list
*/
void wallet_channel_clear_inflights(struct wallet *w,
struct channel *chan);
/**
* After fully resolving a channel, only keep a lightweight stub
*/