wallet: out "wrong_funding" information in the db for persistence.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-03-16 06:55:15 +10:30
parent 30145209a9
commit cce280400c
5 changed files with 159 additions and 122 deletions

View File

@ -709,6 +709,9 @@ static struct migration dbmigrations[] = {
{SQL("ALTER TABLE channels ADD delayed_payment_basepoint_local BLOB"), NULL},
{SQL("ALTER TABLE channels ADD funding_pubkey_local BLOB"), NULL},
{NULL, fillin_missing_local_basepoints},
/* Oops, can I haz money back plz? */
{SQL("ALTER TABLE channels ADD shutdown_wrong_txid BLOB DEFAULT NULL"), NULL},
{SQL("ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL"), NULL},
};
/* Leak tracking. */

View File

@ -926,6 +926,18 @@ struct db_query db_postgres_queries[] = {
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD shutdown_wrong_txid BLOB DEFAULT NULL",
.query = "ALTER TABLE channels ADD shutdown_wrong_txid BYTEA DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL",
.query = "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?",
.query = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = $1",
@ -1275,8 +1287,8 @@ struct db_query db_postgres_queries[] = {
.readonly = true,
},
{
.name = "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 FROM channels WHERE state != ?;",
.query = "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 FROM channels WHERE state != $1;",
.name = "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 != ?;",
.query = "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 != $1;",
.placeholders = 1,
.readonly = true,
},
@ -1870,10 +1882,10 @@ struct db_query db_postgres_queries[] = {
},
};
#define DB_POSTGRES_QUERY_COUNT 310
#define DB_POSTGRES_QUERY_COUNT 312
#endif /* HAVE_POSTGRES */
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
// SHA256STAMP:e3f864d654fc2c6ea7d527a0ceab875e3d01c4a9884c0810dc5981b8ace7df19
// SHA256STAMP:2f7fe69dc5a4d2904d678ad97eea588b6df44bb565b5391ff104c8237e6ff0b9

View File

@ -926,6 +926,18 @@ struct db_query db_sqlite3_queries[] = {
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD shutdown_wrong_txid BLOB DEFAULT NULL",
.query = "ALTER TABLE channels ADD shutdown_wrong_txid BLOB DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL",
.query = "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?",
.query = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?",
@ -1275,8 +1287,8 @@ struct db_query db_sqlite3_queries[] = {
.readonly = true,
},
{
.name = "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 FROM channels WHERE state != ?;",
.query = "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 FROM channels WHERE state != ?;",
.name = "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 != ?;",
.query = "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 != ?;",
.placeholders = 1,
.readonly = true,
},
@ -1870,10 +1882,10 @@ struct db_query db_sqlite3_queries[] = {
},
};
#define DB_SQLITE3_QUERY_COUNT 310
#define DB_SQLITE3_QUERY_COUNT 312
#endif /* HAVE_SQLITE3 */
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
// SHA256STAMP:e3f864d654fc2c6ea7d527a0ceab875e3d01c4a9884c0810dc5981b8ace7df19
// SHA256STAMP:2f7fe69dc5a4d2904d678ad97eea588b6df44bb565b5391ff104c8237e6ff0b9

View File

@ -610,75 +610,83 @@ msgstr ""
msgid "ALTER TABLE channels ADD funding_pubkey_local BLOB"
msgstr ""
#: wallet/db.c:938
#: wallet/db.c:713
msgid "ALTER TABLE channels ADD shutdown_wrong_txid BLOB DEFAULT NULL"
msgstr ""
#: wallet/db.c:714
msgid "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL"
msgstr ""
#: wallet/db.c:941
msgid "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?"
msgstr ""
#: wallet/db.c:1038
#: wallet/db.c:1041
msgid "SELECT version FROM version LIMIT 1"
msgstr ""
#: wallet/db.c:1100
#: wallet/db.c:1103
msgid "UPDATE version SET version=?;"
msgstr ""
#: wallet/db.c:1108
#: wallet/db.c:1111
msgid "INSERT INTO db_upgrades VALUES (?, ?);"
msgstr ""
#: wallet/db.c:1120
#: wallet/db.c:1123
msgid "SELECT intval FROM vars WHERE name = 'data_version'"
msgstr ""
#: wallet/db.c:1147
#: wallet/db.c:1150
msgid "SELECT intval FROM vars WHERE name= ? LIMIT 1"
msgstr ""
#: wallet/db.c:1163
#: wallet/db.c:1166
msgid "UPDATE vars SET intval=? WHERE name=?;"
msgstr ""
#: wallet/db.c:1172
#: wallet/db.c:1175
msgid "INSERT INTO vars (name, intval) VALUES (?, ?);"
msgstr ""
#: wallet/db.c:1186
#: wallet/db.c:1189
msgid "UPDATE channels SET feerate_base = ?, feerate_ppm = ?;"
msgstr ""
#: wallet/db.c:1207
#: wallet/db.c:1210
msgid "UPDATE channels SET our_funding_satoshi = funding_satoshi WHERE funder = 0;"
msgstr ""
#: wallet/db.c:1223
#: wallet/db.c:1226
msgid "SELECT type, keyindex, prev_out_tx, prev_out_index, channel_id, peer_id, commitment_point FROM outputs WHERE scriptpubkey IS NULL;"
msgstr ""
#: wallet/db.c:1285
#: wallet/db.c:1288
msgid "UPDATE outputs SET scriptpubkey = ? WHERE prev_out_tx = ? AND prev_out_index = ?"
msgstr ""
#: wallet/db.c:1310
#: wallet/db.c:1313
msgid "SELECT id, funding_tx_id, funding_tx_outnum FROM channels;"
msgstr ""
#: wallet/db.c:1329
#: wallet/db.c:1332
msgid "UPDATE channels SET full_channel_id = ? WHERE id = ?;"
msgstr ""
#: wallet/db.c:1350
#: wallet/db.c:1353
msgid "SELECT channels.id, peers.node_id FROM channels JOIN peers ON (peers.id = channels.peer_id)"
msgstr ""
#: wallet/db.c:1383
#: wallet/db.c:1386
msgid "UPDATE channels SET revocation_basepoint_local = ?, payment_basepoint_local = ?, htlc_basepoint_local = ?, delayed_payment_basepoint_local = ?, funding_pubkey_local = ? WHERE id = ?;"
msgstr ""
#: wallet/db.c:1414
#: wallet/db.c:1417
msgid "SELECT c.id, p.node_id, c.last_tx, c.funding_satoshi, c.fundingkey_remote, c.last_sig FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id;"
msgstr ""
#: wallet/db.c:1481
#: wallet/db.c:1484
msgid "UPDATE channels SET last_tx = ? WHERE id = ?;"
msgstr ""
@ -843,382 +851,382 @@ msgid "SELECT id FROM channels ORDER BY id DESC LIMIT 1;"
msgstr ""
#: wallet/wallet.c:1268
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 FROM channels WHERE state != ?;"
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:1364
#: wallet/wallet.c:1366
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:1369
#: wallet/wallet.c:1371
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:1374
#: wallet/wallet.c:1376
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:1379
#: wallet/wallet.c:1381
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:1421
#: wallet/wallet.c:1423
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:1450
#: wallet/wallet.c:1452
msgid "SELECT MIN(height), MAX(height) FROM blocks;"
msgstr ""
#: wallet/wallet.c:1472
#: wallet/wallet.c:1474
msgid "INSERT INTO channel_configs DEFAULT VALUES;"
msgstr ""
#: wallet/wallet.c:1484
#: wallet/wallet.c:1486
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:1508
#: wallet/wallet.c:1510
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:1542
#: wallet/wallet.c:1544
msgid "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1561
#: wallet/wallet.c:1563
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=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1644
#: wallet/wallet.c:1646
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:1671
#: wallet/wallet.c:1673
msgid "DELETE FROM channel_feerates WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1681
#: wallet/wallet.c:1683
msgid "INSERT INTO channel_feerates VALUES(?, ?, ?)"
msgstr ""
#: wallet/wallet.c:1698
#: wallet/wallet.c:1700
msgid "UPDATE channels SET last_sent_commit=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1721
#: wallet/wallet.c:1723
msgid "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:1749
#: wallet/wallet.c:1751
msgid "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;"
msgstr ""
#: wallet/wallet.c:1778
#: wallet/wallet.c:1780
msgid "SELECT id FROM peers WHERE node_id = ?"
msgstr ""
#: wallet/wallet.c:1790
#: wallet/wallet.c:1792
msgid "UPDATE peers SET address = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:1799
#: wallet/wallet.c:1801
msgid "INSERT INTO peers (node_id, address) VALUES (?, ?);"
msgstr ""
#: wallet/wallet.c:1820
#: wallet/wallet.c:1822
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:1861
#: wallet/wallet.c:1863
msgid "DELETE FROM channel_htlcs WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1867
#: wallet/wallet.c:1869
msgid "DELETE FROM htlc_sigs WHERE channelid=?"
msgstr ""
#: wallet/wallet.c:1873
#: wallet/wallet.c:1875
msgid "DELETE FROM channeltxs WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1880
#: wallet/wallet.c:1882
msgid "DELETE FROM channel_funding_inflights WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1886
#: wallet/wallet.c:1888
msgid "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)"
msgstr ""
#: wallet/wallet.c:1896
#: wallet/wallet.c:1898
msgid "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?"
msgstr ""
#: wallet/wallet.c:1910
#: wallet/wallet.c:1912
msgid "SELECT * FROM channels WHERE peer_id = ?;"
msgstr ""
#: wallet/wallet.c:1918
#: wallet/wallet.c:1920
msgid "DELETE FROM peers WHERE id=?"
msgstr ""
#: wallet/wallet.c:1929
#: wallet/wallet.c:1931
msgid "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?"
msgstr ""
#: wallet/wallet.c:2032
#: wallet/wallet.c:2034
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:2085
#: wallet/wallet.c:2087
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:2146
#: wallet/wallet.c:2148
msgid "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:2362
#: wallet/wallet.c:2364
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:2409
#: wallet/wallet.c:2411
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:2540
#: wallet/wallet.c:2542
msgid "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;"
msgstr ""
#: wallet/wallet.c:2574
#: wallet/wallet.c:2576
msgid "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2627
#: wallet/wallet.c:2629
msgid "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2645
#: wallet/wallet.c:2647
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:2734
#: wallet/wallet.c:2736
msgid "DELETE FROM payments WHERE payment_hash = ? AND partid = ?"
msgstr ""
#: wallet/wallet.c:2748
#: wallet/wallet.c:2750
msgid "DELETE FROM payments WHERE payment_hash = ?"
msgstr ""
#: wallet/wallet.c:2849
#: wallet/wallet.c:2851
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:2899
#: wallet/wallet.c:2901
msgid "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?"
msgstr ""
#: wallet/wallet.c:2909
#: wallet/wallet.c:2911
msgid "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?"
msgstr ""
#: wallet/wallet.c:2919
#: wallet/wallet.c:2921
msgid "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2951
#: wallet/wallet.c:2953
msgid "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;"
msgstr ""
#: wallet/wallet.c:3018
#: wallet/wallet.c:3020
msgid "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;"
msgstr ""
#: wallet/wallet.c:3077
#: wallet/wallet.c:3079
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:3099
#: wallet/wallet.c:3101
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:3150
#: wallet/wallet.c:3152
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:3195
#: wallet/wallet.c:3197
msgid "DELETE FROM htlc_sigs WHERE channelid = ?"
msgstr ""
#: wallet/wallet.c:3202
#: wallet/wallet.c:3204
msgid "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)"
msgstr ""
#: wallet/wallet.c:3214
#: wallet/wallet.c:3216
msgid "SELECT blobval FROM vars WHERE name='genesis_hash'"
msgstr ""
#: wallet/wallet.c:3238
#: wallet/wallet.c:3240
msgid "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);"
msgstr ""
#: wallet/wallet.c:3256
#: wallet/wallet.c:3258
msgid "SELECT txid, outnum FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3268
#: wallet/wallet.c:3270
msgid "DELETE FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3276 wallet/wallet.c:3390
#: wallet/wallet.c:3278 wallet/wallet.c:3392
msgid "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3295
#: wallet/wallet.c:3297
msgid "DELETE FROM blocks WHERE hash = ?"
msgstr ""
#: wallet/wallet.c:3301
#: wallet/wallet.c:3303
msgid "SELECT * FROM blocks WHERE height >= ?;"
msgstr ""
#: wallet/wallet.c:3310
#: wallet/wallet.c:3312
msgid "DELETE FROM blocks WHERE height > ?"
msgstr ""
#: wallet/wallet.c:3322
#: wallet/wallet.c:3324
msgid "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?"
msgstr ""
#: wallet/wallet.c:3340
#: wallet/wallet.c:3342
msgid "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?"
msgstr ""
#: wallet/wallet.c:3363 wallet/wallet.c:3401
#: wallet/wallet.c:3365 wallet/wallet.c:3403
msgid "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3427
#: wallet/wallet.c:3429
msgid "SELECT height FROM blocks WHERE height = ?"
msgstr ""
#: wallet/wallet.c:3440
#: wallet/wallet.c:3442
msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL"
msgstr ""
#: wallet/wallet.c:3482
#: wallet/wallet.c:3484
msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?"
msgstr ""
#: wallet/wallet.c:3513 wallet/wallet.c:3673
#: wallet/wallet.c:3515 wallet/wallet.c:3675
msgid "SELECT blockheight FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3523
#: wallet/wallet.c:3525
msgid "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3544
#: wallet/wallet.c:3546
msgid "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3561
#: wallet/wallet.c:3563
msgid "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;"
msgstr ""
#: wallet/wallet.c:3593
#: wallet/wallet.c:3595
msgid "SELECT type, channel_id FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3609
#: wallet/wallet.c:3611
msgid "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3628
#: wallet/wallet.c:3630
msgid "SELECT type FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3651
#: wallet/wallet.c:3653
msgid "SELECT rawtx FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3697
#: wallet/wallet.c:3699
msgid "SELECT blockheight, txindex FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3725
#: wallet/wallet.c:3727
msgid "SELECT id FROM transactions WHERE blockheight=?"
msgstr ""
#: wallet/wallet.c:3744
#: wallet/wallet.c:3746
msgid "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3768
#: wallet/wallet.c:3770
msgid "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;"
msgstr ""
#: wallet/wallet.c:3789
#: wallet/wallet.c:3791
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:3834
#: wallet/wallet.c:3836
msgid "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?"
msgstr ""
#: wallet/wallet.c:3892
#: wallet/wallet.c:3894
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:3951
#: wallet/wallet.c:3953
msgid "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;"
msgstr ""
#: wallet/wallet.c:4000
#: wallet/wallet.c:4002
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:4122
#: wallet/wallet.c:4124
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:4216
#: wallet/wallet.c:4218
msgid "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4241
#: wallet/wallet.c:4243
msgid "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?"
msgstr ""
#: wallet/wallet.c:4265
#: wallet/wallet.c:4267
msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?"
msgstr ""
#: wallet/wallet.c:4283
#: wallet/wallet.c:4285
msgid "SELECT 1 FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4296
#: wallet/wallet.c:4298
msgid "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4323
#: wallet/wallet.c:4325
msgid "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4351
#: wallet/wallet.c:4353
msgid "SELECT offer_id FROM offers;"
msgstr ""
#: wallet/wallet.c:4377
#: wallet/wallet.c:4379
msgid "UPDATE offers SET status=? WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4388
#: wallet/wallet.c:4390
msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4416
#: wallet/wallet.c:4418
msgid "SELECT status FROM offers WHERE offer_id = ?;"
msgstr ""
@ -1237,4 +1245,4 @@ msgstr ""
#: wallet/test/run-wallet.c:1632
msgid "INSERT INTO channels (id) VALUES (1);"
msgstr ""
# SHA256STAMP:1fc9393bed969dc69c684eb5d842785d2386df6ac5418404d36a0e2a5657e974
# SHA256STAMP:8c8e651c259b33910c13fff8fa52d1ada04a025436dfa5bd40557652600d586e

View File

@ -1323,6 +1323,8 @@ static bool wallet_channels_load_active(struct wallet *w)
", htlc_basepoint_local" // 54
", delayed_payment_basepoint_local" // 55
", funding_pubkey_local" // 56
", shutdown_wrong_txid" // 57
", shutdown_wrong_outnum" // 58
" FROM channels"
" WHERE state != ?;")); //? 0
db_bind_int(stmt, 0, CLOSED);