diff --git a/wallet/db_postgres_sqlgen.c b/wallet/db_postgres_sqlgen.c index 2ec8c9400..a5c4b9335 100644 --- a/wallet/db_postgres_sqlgen.c +++ b/wallet/db_postgres_sqlgen.c @@ -2032,4 +2032,4 @@ struct db_query db_postgres_queries[] = { #endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */ -// SHA256STAMP:df06b800543e6bb886100ca428247ac1097f749098779dae43ba875154700f58 +// SHA256STAMP:1423567c921b088aefdd7a07fcbfa2db1903ef4e2410550eccb5574a9f133f28 diff --git a/wallet/db_sqlite3_sqlgen.c b/wallet/db_sqlite3_sqlgen.c index 5f276fc3d..3ea1a3d77 100644 --- a/wallet/db_sqlite3_sqlgen.c +++ b/wallet/db_sqlite3_sqlgen.c @@ -2032,4 +2032,4 @@ struct db_query db_sqlite3_queries[] = { #endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */ -// SHA256STAMP:df06b800543e6bb886100ca428247ac1097f749098779dae43ba875154700f58 +// SHA256STAMP:1423567c921b088aefdd7a07fcbfa2db1903ef4e2410550eccb5574a9f133f28 diff --git a/wallet/statements_gettextgen.po b/wallet/statements_gettextgen.po index b4419e5ac..330a0ac4f 100644 --- a/wallet/statements_gettextgen.po +++ b/wallet/statements_gettextgen.po @@ -826,7 +826,7 @@ msgstr "" msgid "SELECT txid, outnum FROM utxoset WHERE spendheight is NULL" msgstr "" -#: wallet/wallet.c:107 wallet/wallet.c:605 +#: wallet/wallet.c:107 wallet/wallet.c:611 msgid "SELECT * from outputs WHERE prev_out_tx=? AND prev_out_index=?" msgstr "" @@ -862,467 +862,467 @@ msgstr "" msgid "UPDATE outputs SET status=?, reserved_til=? WHERE prev_out_tx=? AND prev_out_index=?" msgstr "" -#: wallet/wallet.c:551 +#: wallet/wallet.c:557 msgid "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til, csv_lock FROM outputs WHERE status = ? OR (status = ? AND reserved_til <= ?)ORDER BY RANDOM();" msgstr "" -#: wallet/wallet.c:619 +#: wallet/wallet.c:625 msgid "INSERT INTO outputs ( prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, csv_lock) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:726 +#: wallet/wallet.c:732 msgid "INSERT INTO shachains (min_index, num_valid) VALUES (?, 0);" msgstr "" -#: wallet/wallet.c:770 +#: wallet/wallet.c:776 msgid "UPDATE shachains SET num_valid=?, min_index=? WHERE id=?" msgstr "" -#: wallet/wallet.c:777 +#: wallet/wallet.c:783 msgid "UPDATE shachain_known SET idx=?, hash=? WHERE shachain_id=? AND pos=?" msgstr "" -#: wallet/wallet.c:789 +#: wallet/wallet.c:795 msgid "INSERT INTO shachain_known (shachain_id, pos, idx, hash) VALUES (?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:811 +#: wallet/wallet.c:817 msgid "SELECT min_index, num_valid FROM shachains WHERE id=?" msgstr "" -#: wallet/wallet.c:826 +#: wallet/wallet.c:832 msgid "SELECT idx, hash, pos FROM shachain_known WHERE shachain_id=?" msgstr "" -#: wallet/wallet.c:849 +#: wallet/wallet.c:855 msgid "SELECT id, node_id, address FROM peers WHERE id=?;" msgstr "" -#: wallet/wallet.c:882 +#: wallet/wallet.c:888 msgid "SELECT signature FROM htlc_sigs WHERE channelid = ?" msgstr "" -#: wallet/wallet.c:916 +#: wallet/wallet.c:922 msgid "SELECT remote_ann_node_sig, remote_ann_bitcoin_sig FROM channels WHERE id = ?" msgstr "" -#: wallet/wallet.c:960 +#: wallet/wallet.c:966 msgid "SELECT hstate, feerate_per_kw FROM channel_feerates WHERE channel_id = ?" msgstr "" -#: wallet/wallet.c:996 +#: wallet/wallet.c:1002 msgid "SELECT hstate, blockheight FROM channel_blockheights WHERE channel_id = ?" msgstr "" -#: wallet/wallet.c:1029 +#: wallet/wallet.c:1035 msgid "INSERT INTO channel_funding_inflights ( channel_id, funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_expiry, lease_blockheight_start) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:1085 +#: wallet/wallet.c:1091 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:1108 +#: wallet/wallet.c:1114 msgid "DELETE FROM channel_funding_inflights WHERE channel_id = ?" msgstr "" -#: wallet/wallet.c:1178 +#: wallet/wallet.c:1184 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, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_blockheight_start FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate" msgstr "" -#: wallet/wallet.c:1446 +#: wallet/wallet.c:1452 msgid "SELECT id FROM channels ORDER BY id DESC LIMIT 1;" msgstr "" -#: wallet/wallet.c:1463 +#: wallet/wallet.c:1469 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, local_static_remotekey_start, remote_static_remotekey_start, 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, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channels WHERE state != ?;" msgstr "" -#: wallet/wallet.c:1575 +#: wallet/wallet.c:1581 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:1581 +#: wallet/wallet.c:1587 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:1587 +#: wallet/wallet.c:1593 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:1593 +#: wallet/wallet.c:1599 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:1638 +#: wallet/wallet.c:1644 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:1667 +#: wallet/wallet.c:1673 msgid "SELECT MIN(height), MAX(height) FROM blocks;" msgstr "" -#: wallet/wallet.c:1689 +#: wallet/wallet.c:1695 msgid "INSERT INTO channel_configs DEFAULT VALUES;" msgstr "" -#: wallet/wallet.c:1701 +#: wallet/wallet.c:1707 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:1725 +#: wallet/wallet.c:1731 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:1759 +#: wallet/wallet.c:1765 msgid "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?" msgstr "" -#: wallet/wallet.c:1778 +#: wallet/wallet.c:1784 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=?, local_static_remotekey_start=?, remote_static_remotekey_start=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=?, lease_expiry=?, lease_commit_sig=?, lease_chan_max_msat=?, lease_chan_max_ppt=? WHERE id=?" msgstr "" -#: wallet/wallet.c:1887 +#: wallet/wallet.c:1893 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:1914 +#: wallet/wallet.c:1920 msgid "DELETE FROM channel_feerates WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:1924 +#: wallet/wallet.c:1930 msgid "INSERT INTO channel_feerates VALUES(?, ?, ?)" msgstr "" -#: wallet/wallet.c:1933 +#: wallet/wallet.c:1939 msgid "DELETE FROM channel_blockheights WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:1943 +#: wallet/wallet.c:1949 msgid "INSERT INTO channel_blockheights VALUES(?, ?, ?)" msgstr "" -#: wallet/wallet.c:1960 +#: wallet/wallet.c:1966 msgid "UPDATE channels SET last_sent_commit=? WHERE id=?" msgstr "" -#: wallet/wallet.c:1983 +#: wallet/wallet.c:1989 msgid "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:2011 +#: wallet/wallet.c:2017 msgid "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;" msgstr "" -#: wallet/wallet.c:2040 +#: wallet/wallet.c:2046 msgid "SELECT id FROM peers WHERE node_id = ?" msgstr "" -#: wallet/wallet.c:2052 +#: wallet/wallet.c:2058 msgid "UPDATE peers SET address = ? WHERE id = ?" msgstr "" -#: wallet/wallet.c:2061 +#: wallet/wallet.c:2067 msgid "INSERT INTO peers (node_id, address) VALUES (?, ?);" msgstr "" -#: wallet/wallet.c:2082 +#: wallet/wallet.c:2088 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:2123 +#: wallet/wallet.c:2129 msgid "DELETE FROM channel_htlcs WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:2129 +#: wallet/wallet.c:2135 msgid "DELETE FROM htlc_sigs WHERE channelid=?" msgstr "" -#: wallet/wallet.c:2135 +#: wallet/wallet.c:2141 msgid "DELETE FROM channeltxs WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:2142 +#: wallet/wallet.c:2148 msgid "DELETE FROM channel_funding_inflights WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:2148 +#: wallet/wallet.c:2154 msgid "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)" msgstr "" -#: wallet/wallet.c:2158 +#: wallet/wallet.c:2164 msgid "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?" msgstr "" -#: wallet/wallet.c:2172 +#: wallet/wallet.c:2178 msgid "SELECT * FROM channels WHERE peer_id = ?;" msgstr "" -#: wallet/wallet.c:2180 +#: wallet/wallet.c:2186 msgid "DELETE FROM peers WHERE id=?" msgstr "" -#: wallet/wallet.c:2191 +#: wallet/wallet.c:2197 msgid "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?" msgstr "" -#: wallet/wallet.c:2294 +#: wallet/wallet.c:2300 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:2347 +#: wallet/wallet.c:2353 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:2408 +#: wallet/wallet.c:2414 msgid "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?" msgstr "" -#: wallet/wallet.c:2625 +#: wallet/wallet.c:2631 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:2672 +#: wallet/wallet.c:2678 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:2803 +#: wallet/wallet.c:2809 msgid "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;" msgstr "" -#: wallet/wallet.c:2837 +#: wallet/wallet.c:2843 msgid "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;" msgstr "" -#: wallet/wallet.c:2890 +#: wallet/wallet.c:2896 msgid "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;" msgstr "" -#: wallet/wallet.c:2908 +#: wallet/wallet.c:2914 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:2997 +#: wallet/wallet.c:3003 msgid "DELETE FROM payments WHERE payment_hash = ? AND partid = ?" msgstr "" -#: wallet/wallet.c:3011 +#: wallet/wallet.c:3017 msgid "DELETE FROM payments WHERE payment_hash = ?" msgstr "" -#: wallet/wallet.c:3112 +#: wallet/wallet.c:3118 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:3162 +#: wallet/wallet.c:3168 msgid "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?" msgstr "" -#: wallet/wallet.c:3172 +#: wallet/wallet.c:3178 msgid "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?" msgstr "" -#: wallet/wallet.c:3182 +#: wallet/wallet.c:3188 msgid "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;" msgstr "" -#: wallet/wallet.c:3214 +#: wallet/wallet.c:3220 msgid "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;" msgstr "" -#: wallet/wallet.c:3281 +#: wallet/wallet.c:3287 msgid "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;" msgstr "" -#: wallet/wallet.c:3340 +#: wallet/wallet.c:3346 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:3363 +#: wallet/wallet.c:3369 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:3414 +#: wallet/wallet.c:3420 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:3459 +#: wallet/wallet.c:3465 msgid "DELETE FROM htlc_sigs WHERE channelid = ?" msgstr "" -#: wallet/wallet.c:3466 +#: wallet/wallet.c:3472 msgid "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)" msgstr "" -#: wallet/wallet.c:3478 +#: wallet/wallet.c:3484 msgid "SELECT blobval FROM vars WHERE name='genesis_hash'" msgstr "" -#: wallet/wallet.c:3502 +#: wallet/wallet.c:3508 msgid "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);" msgstr "" -#: wallet/wallet.c:3520 +#: wallet/wallet.c:3526 msgid "SELECT txid, outnum FROM utxoset WHERE spendheight < ?" msgstr "" -#: wallet/wallet.c:3532 +#: wallet/wallet.c:3538 msgid "DELETE FROM utxoset WHERE spendheight < ?" msgstr "" -#: wallet/wallet.c:3540 wallet/wallet.c:3654 +#: wallet/wallet.c:3546 wallet/wallet.c:3660 msgid "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);" msgstr "" -#: wallet/wallet.c:3559 +#: wallet/wallet.c:3565 msgid "DELETE FROM blocks WHERE hash = ?" msgstr "" -#: wallet/wallet.c:3565 +#: wallet/wallet.c:3571 msgid "SELECT * FROM blocks WHERE height >= ?;" msgstr "" -#: wallet/wallet.c:3574 +#: wallet/wallet.c:3580 msgid "DELETE FROM blocks WHERE height > ?" msgstr "" -#: wallet/wallet.c:3586 +#: wallet/wallet.c:3592 msgid "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?" msgstr "" -#: wallet/wallet.c:3604 +#: wallet/wallet.c:3610 msgid "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?" msgstr "" -#: wallet/wallet.c:3627 wallet/wallet.c:3665 +#: wallet/wallet.c:3633 wallet/wallet.c:3671 msgid "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:3691 +#: wallet/wallet.c:3697 msgid "SELECT height FROM blocks WHERE height = ?" msgstr "" -#: wallet/wallet.c:3704 +#: wallet/wallet.c:3710 msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL" msgstr "" -#: wallet/wallet.c:3768 +#: wallet/wallet.c:3774 msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?" msgstr "" -#: wallet/wallet.c:3785 +#: wallet/wallet.c:3791 msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE blockheight = ?" msgstr "" -#: wallet/wallet.c:3802 wallet/wallet.c:3962 +#: wallet/wallet.c:3808 wallet/wallet.c:3968 msgid "SELECT blockheight FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3812 +#: wallet/wallet.c:3818 msgid "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:3833 +#: wallet/wallet.c:3839 msgid "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?" msgstr "" -#: wallet/wallet.c:3850 +#: wallet/wallet.c:3856 msgid "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;" msgstr "" -#: wallet/wallet.c:3882 +#: wallet/wallet.c:3888 msgid "SELECT type, channel_id FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3898 +#: wallet/wallet.c:3904 msgid "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?" msgstr "" -#: wallet/wallet.c:3917 +#: wallet/wallet.c:3923 msgid "SELECT type FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3940 +#: wallet/wallet.c:3946 msgid "SELECT rawtx FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3986 +#: wallet/wallet.c:3992 msgid "SELECT blockheight, txindex FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:4014 +#: wallet/wallet.c:4020 msgid "SELECT id FROM transactions WHERE blockheight=?" msgstr "" -#: wallet/wallet.c:4033 +#: wallet/wallet.c:4039 msgid "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:4057 +#: wallet/wallet.c:4063 msgid "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;" msgstr "" -#: wallet/wallet.c:4078 +#: wallet/wallet.c:4084 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:4123 +#: wallet/wallet.c:4129 msgid "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?" msgstr "" -#: wallet/wallet.c:4181 +#: wallet/wallet.c:4187 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:4240 +#: wallet/wallet.c:4246 msgid "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;" msgstr "" -#: wallet/wallet.c:4289 +#: wallet/wallet.c:4295 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:4411 +#: wallet/wallet.c:4417 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:4505 +#: wallet/wallet.c:4511 msgid "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:4530 +#: wallet/wallet.c:4536 msgid "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?" msgstr "" -#: wallet/wallet.c:4554 +#: wallet/wallet.c:4560 msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?" msgstr "" -#: wallet/wallet.c:4572 +#: wallet/wallet.c:4578 msgid "SELECT 1 FROM offers WHERE offer_id = ?;" msgstr "" -#: wallet/wallet.c:4585 +#: wallet/wallet.c:4591 msgid "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:4612 +#: wallet/wallet.c:4618 msgid "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;" msgstr "" -#: wallet/wallet.c:4640 +#: wallet/wallet.c:4646 msgid "SELECT offer_id FROM offers;" msgstr "" -#: wallet/wallet.c:4666 +#: wallet/wallet.c:4672 msgid "UPDATE offers SET status=? WHERE offer_id = ?;" msgstr "" -#: wallet/wallet.c:4677 +#: wallet/wallet.c:4683 msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;" msgstr "" -#: wallet/wallet.c:4705 +#: wallet/wallet.c:4711 msgid "SELECT status FROM offers WHERE offer_id = ?;" msgstr "" @@ -1334,11 +1334,11 @@ msgstr "" msgid "not a valid SQL statement" msgstr "" -#: wallet/test/run-wallet.c:1483 +#: wallet/test/run-wallet.c:1539 msgid "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = ?;" msgstr "" -#: wallet/test/run-wallet.c:1696 +#: wallet/test/run-wallet.c:1752 msgid "INSERT INTO channels (id) VALUES (1);" msgstr "" -# SHA256STAMP:d0ba3b9e4e392f7327662f333f4712582f7553a819d588ebb3641b229215e90f +# SHA256STAMP:49a5aa519d315c36016e3d27177f0f5c1fae5ab8aa24d8c57dd8da18fcb75a4d diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c index ad4d2c04c..1aee68d2e 100644 --- a/wallet/test/run-wallet.c +++ b/wallet/test/run-wallet.c @@ -1006,6 +1006,9 @@ static bool test_wallet_outputs(struct lightningd *ld, const tal_t *ctx) struct utxo u; struct pubkey pk; struct node_id id; + struct wireaddr_internal addr; + struct block block; + struct channel channel; struct utxo *one_utxo; const struct utxo **utxos; CHECK(w); @@ -1020,10 +1023,12 @@ static bool test_wallet_outputs(struct lightningd *ld, const tal_t *ctx) /* Should work, it's the first time we add it */ CHECK_MSG(wallet_add_utxo(w, &u, p2sh_wpkh), "wallet_add_utxo failed on first add"); + CHECK_MSG(!wallet_err, wallet_err); /* Should fail, we already have that UTXO */ CHECK_MSG(!wallet_add_utxo(w, &u, p2sh_wpkh), "wallet_add_utxo succeeded on second add"); + CHECK_MSG(!wallet_err, wallet_err); /* Attempt to save an UTXO with close_info set */ memset(&u.txid, 1, sizeof(u.txid)); @@ -1040,7 +1045,7 @@ static bool test_wallet_outputs(struct lightningd *ld, const tal_t *ctx) /* Now select them */ utxos = tal_arr(w, const struct utxo *, 0); - while ((one_utxo = wallet_find_utxo(w, w, 0, NULL, 253, + while ((one_utxo = wallet_find_utxo(w, w, 100, NULL, 253, 0 /* no confirmations required */, utxos)) != NULL) { tal_arr_expand(&utxos, one_utxo); @@ -1089,20 +1094,49 @@ static bool test_wallet_outputs(struct lightningd *ld, const tal_t *ctx) u.close_info->peer_id = id; u.close_info->commitment_point = NULL; u.close_info->option_anchor_outputs = true; + /* The blockheight has to be set for an option_anchor_output + * closed UTXO to be spendable */ + u32 *blockheight = tal(w, u32); + *blockheight = 100; + /* We gotta add a block to the database though */ + block.height = 100; + memset(&block.blkid, 2, sizeof(block.blkid)); + wallet_block_add(w, &block); + CHECK_MSG(!wallet_err, wallet_err); + + u.blockheight = blockheight; u.scriptPubkey = tal_arr(w, u8, 20); memset(u.scriptPubkey, 1, 20); CHECK_MSG(wallet_add_utxo(w, &u, p2sh_wpkh), "wallet_add_utxo with close_info no commitment_point"); + CHECK_MSG(!wallet_err, wallet_err); - /* Now select it */ + /* Add another utxo that's CSV-locked for 5 blocks */ + parse_wireaddr_internal("localhost:1234", &addr, 0, false, false, false, + true, NULL); + channel.peer = new_peer(ld, 0, &id, &addr, false); + channel.dbid = 1; + channel.option_anchor_outputs = true; + memset(&u.txid, 3, sizeof(u.txid)); + CHECK_MSG(wallet_add_onchaind_utxo(w, &u.txid, + u.outnum, + u.scriptPubkey, + *u.blockheight, + AMOUNT_SAT(3), + &channel, + NULL, + 5), + "wallet_add_utxo with close_info and csv > 1"); + CHECK_MSG(!wallet_err, wallet_err); + + /* Select everything but 5 csv-locked utxo */ utxos = tal_arr(w, const struct utxo *, 0); - while ((one_utxo = wallet_find_utxo(w, w, 0, NULL, 253, + while ((one_utxo = wallet_find_utxo(w, w, 100, NULL, 253, 0 /* no confirmations required */, utxos)) != NULL) { tal_arr_expand(&utxos, one_utxo); } CHECK(tal_count(utxos) == 2); - if (utxos[0]->close_info) u = *utxos[0]; else @@ -1111,7 +1145,29 @@ static bool test_wallet_outputs(struct lightningd *ld, const tal_t *ctx) CHECK(u.close_info->channel_id == 42 && u.close_info->commitment_point == NULL && node_id_eq(&u.close_info->peer_id, &id) && - u.close_info->option_anchor_outputs == true); + u.close_info->option_anchor_outputs == true && + u.close_info->csv == 1); + /* Now un-reserve them */ + tal_free(utxos); + + /* Select all utxos (5 csv-locked included) */ + utxos = tal_arr(w, const struct utxo *, 0); + while ((one_utxo = wallet_find_utxo(w, w, 104, NULL, 253, + 0 /* no confirmations required */, + utxos)) != NULL) { + tal_arr_expand(&utxos, one_utxo); + } + CHECK(tal_count(utxos) == 3); + for (size_t i = 0; i < tal_count(utxos); i++) { + if (!utxos[i]->close_info) + continue; + + CHECK(u.close_info->channel_id == 42 && + u.close_info->commitment_point == NULL && + node_id_eq(&u.close_info->peer_id, &id) && + u.close_info->option_anchor_outputs == true && + u.close_info->csv > 0); + } /* Now un-reserve them */ tal_free(utxos); @@ -1866,12 +1922,12 @@ int main(int argc, const char *argv[]) htlc_in_map_init(&ld->htlcs_in); htlc_out_map_init(&ld->htlcs_out); - ok &= test_wallet_outputs(ld, tmpctx); ok &= test_shachain_crud(ld, tmpctx); ok &= test_channel_crud(ld, tmpctx); ok &= test_channel_inflight_crud(ld, tmpctx); ok &= test_channel_config_crud(ld, tmpctx); ok &= test_channel_inflight_crud(ld, tmpctx); + ok &= test_wallet_outputs(ld, tmpctx); ok &= test_htlc_crud(ld, tmpctx); ok &= test_payment_crud(ld, tmpctx); ok &= test_wallet_payment_status_enum(); diff --git a/wallet/wallet.c b/wallet/wallet.c index e3d5da7f7..91fe8a8e5 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -519,6 +519,19 @@ static bool excluded(const struct utxo **excludes, static bool deep_enough(u32 maxheight, const struct utxo *utxo, u32 current_blockheight) { + if (utxo->close_info + && utxo->close_info->option_anchor_outputs) { + /* All option_anchor_output close_infos + * have a csv of at least 1 */ + if (!utxo->blockheight) + return false; + + u32 csv_free = *utxo->blockheight + utxo->close_info->csv - 1; + assert(csv_free >= *utxo->blockheight); + + if (csv_free > current_blockheight) + return false; + } /* If we require confirmations check that we have a * confirmation height and that it is below the required * maxheight (current_height - minconf) */ @@ -526,13 +539,6 @@ static bool deep_enough(u32 maxheight, const struct utxo *utxo, return true; if (!utxo->blockheight) return false; - /* Check that CSV-lock is now free! */ - if (utxo->close_info) { - u32 csv_free = *utxo->blockheight + utxo->close_info->csv; - assert(csv_free > *utxo->blockheight); - if (current_blockheight < csv_free) - return false; - } return *utxo->blockheight <= maxheight; }