diff --git a/lightningd/channel.c b/lightningd/channel.c index 05691df5d..6b11d3fb7 100644 --- a/lightningd/channel.c +++ b/lightningd/channel.c @@ -163,6 +163,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid, struct amount_msat push, struct amount_sat our_funds, bool remote_funding_locked, + bool remote_tx_sigs, /* NULL or stolen */ struct short_channel_id *scid, struct channel_id *cid, @@ -239,6 +240,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid, channel->push = push; channel->our_funds = our_funds; channel->remote_funding_locked = remote_funding_locked; + channel->remote_tx_sigs = remote_tx_sigs; channel->scid = tal_steal(channel, scid); channel->cid = *cid; channel->our_msat = our_msat; diff --git a/lightningd/channel.h b/lightningd/channel.h index 6abd49442..273d6062a 100644 --- a/lightningd/channel.h +++ b/lightningd/channel.h @@ -70,6 +70,7 @@ struct channel { struct amount_msat push; bool remote_funding_locked; + bool remote_tx_sigs; /* Channel if locked locally. */ struct short_channel_id *scid; @@ -182,6 +183,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid, struct amount_msat push, struct amount_sat our_funds, bool remote_funding_locked, + bool remote_tx_sigs, /* NULL or stolen */ struct short_channel_id *scid STEALS, struct channel_id *cid, diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index ad384cf6e..d825aba28 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -645,6 +645,7 @@ wallet_commit_channel(struct lightningd *ld, AMOUNT_MSAT(0), our_funding, false, /* !remote_funding_locked */ + false, /* !remote_tx_sigs */ NULL, /* no scid yet */ cid, /* The three arguments below are msatoshi_to_us, @@ -1388,6 +1389,10 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend, return; } + /* Save that we've gotten their sigs. Sometimes + * the peer doesn't send any sigs (no inputs), otherwise + * we could just check the PSBT was finalized */ + channel->remote_tx_sigs = true; tal_wally_start(); if (wally_psbt_combine(channel->psbt, psbt) != WALLY_OK) { channel_internal_error(channel, diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c index 38ce9e705..ce69500e4 100644 --- a/lightningd/opening_control.c +++ b/lightningd/opening_control.c @@ -176,6 +176,7 @@ wallet_commit_channel(struct lightningd *ld, push, local_funding, false, /* !remote_funding_locked */ + false, /* !remote_tx_sigs */ NULL, /* no scid yet */ cid, /* The three arguments below are msatoshi_to_us, diff --git a/wallet/db.c b/wallet/db.c index d9843b9f2..d1316ede4 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -668,6 +668,7 @@ static struct migration dbmigrations[] = { {SQL("ALTER TABLE invoices ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);"), NULL}, /* A reference into our own offers table, if it was made from one */ {SQL("ALTER TABLE payments ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);"), NULL}, + {SQL("ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;"), NULL}, }; /* Leak tracking. */ diff --git a/wallet/db_postgres_sqlgen.c b/wallet/db_postgres_sqlgen.c index c5f4b6904..f10220a98 100644 --- a/wallet/db_postgres_sqlgen.c +++ b/wallet/db_postgres_sqlgen.c @@ -866,6 +866,12 @@ struct db_query db_postgres_queries[] = { .placeholders = 0, .readonly = false, }, + { + .name = "ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;", + .query = "ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;", + .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", @@ -1185,8 +1191,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, funding_psbt, closer, state_change_reason 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, funding_psbt, closer, state_change_reason 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, funding_tx_remote_sigs_received, 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, funding_psbt, closer, state_change_reason 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, funding_tx_remote_sigs_received, 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, funding_psbt, closer, state_change_reason FROM channels WHERE state != $1;", .placeholders = 1, .readonly = true, }, @@ -1251,9 +1257,9 @@ struct db_query db_postgres_queries[] = { .readonly = false, }, { - .name = "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=?, funding_psbt=?, closer=?, state_change_reason=? WHERE id=?", - .query = "UPDATE channels SET shachain_remote_id=$1, short_channel_id=$2, full_channel_id=$3, state=$4, funder=$5, channel_flags=$6, minimum_depth=$7, next_index_local=$8, next_index_remote=$9, next_htlc_id=$10, funding_tx_id=$11, funding_tx_outnum=$12, funding_satoshi=$13, our_funding_satoshi=$14, funding_locked_remote=$15, push_msatoshi=$16, msatoshi_local=$17, shutdown_scriptpubkey_remote=$18, shutdown_keyidx_local=$19, channel_config_local=$20, last_tx=$21, last_sig=$22, last_was_revoke=$23, min_possible_feerate=$24, max_possible_feerate=$25, msatoshi_to_us_min=$26, msatoshi_to_us_max=$27, feerate_base=$28, feerate_ppm=$29, remote_upfront_shutdown_script=$30, option_static_remotekey=$31, option_anchor_outputs=$32, shutdown_scriptpubkey_local=$33, funding_psbt=$34, closer=$35, state_change_reason=$36 WHERE id=$37", - .placeholders = 37, + .name = "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=?, funding_tx_remote_sigs_received=?, 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=?, funding_psbt=?, closer=?, state_change_reason=? WHERE id=?", + .query = "UPDATE channels SET shachain_remote_id=$1, short_channel_id=$2, full_channel_id=$3, state=$4, funder=$5, channel_flags=$6, minimum_depth=$7, next_index_local=$8, next_index_remote=$9, next_htlc_id=$10, funding_tx_id=$11, funding_tx_outnum=$12, funding_satoshi=$13, our_funding_satoshi=$14, funding_locked_remote=$15, funding_tx_remote_sigs_received=$16, push_msatoshi=$17, msatoshi_local=$18, shutdown_scriptpubkey_remote=$19, shutdown_keyidx_local=$20, channel_config_local=$21, last_tx=$22, last_sig=$23, last_was_revoke=$24, min_possible_feerate=$25, max_possible_feerate=$26, msatoshi_to_us_min=$27, msatoshi_to_us_max=$28, feerate_base=$29, feerate_ppm=$30, remote_upfront_shutdown_script=$31, option_static_remotekey=$32, option_anchor_outputs=$33, shutdown_scriptpubkey_local=$34, funding_psbt=$35, closer=$36, state_change_reason=$37 WHERE id=$38", + .placeholders = 38, .readonly = false, }, { @@ -1768,10 +1774,10 @@ struct db_query db_postgres_queries[] = { }, }; -#define DB_POSTGRES_QUERY_COUNT 293 +#define DB_POSTGRES_QUERY_COUNT 294 #endif /* HAVE_POSTGRES */ #endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */ -// SHA256STAMP:3b9fa7f4f741852169761dc4172ffbd3a61c877aa6ebd07ae24e1ddb10e49f7a +// SHA256STAMP:6ab0acf78761f626e452b9d6b83206d2546872001c93779eeb2f15ff8accd62f diff --git a/wallet/db_sqlite3_sqlgen.c b/wallet/db_sqlite3_sqlgen.c index ebc1bf557..36f559106 100644 --- a/wallet/db_sqlite3_sqlgen.c +++ b/wallet/db_sqlite3_sqlgen.c @@ -866,6 +866,12 @@ struct db_query db_sqlite3_queries[] = { .placeholders = 0, .readonly = false, }, + { + .name = "ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;", + .query = "ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;", + .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 = ?", @@ -1185,8 +1191,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, funding_psbt, closer, state_change_reason 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, funding_psbt, closer, state_change_reason 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, funding_tx_remote_sigs_received, 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, funding_psbt, closer, state_change_reason 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, funding_tx_remote_sigs_received, 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, funding_psbt, closer, state_change_reason FROM channels WHERE state != ?;", .placeholders = 1, .readonly = true, }, @@ -1251,9 +1257,9 @@ struct db_query db_sqlite3_queries[] = { .readonly = false, }, { - .name = "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=?, funding_psbt=?, closer=?, state_change_reason=? WHERE id=?", - .query = "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=?, funding_psbt=?, closer=?, state_change_reason=? WHERE id=?", - .placeholders = 37, + .name = "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=?, funding_tx_remote_sigs_received=?, 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=?, funding_psbt=?, closer=?, state_change_reason=? WHERE id=?", + .query = "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=?, funding_tx_remote_sigs_received=?, 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=?, funding_psbt=?, closer=?, state_change_reason=? WHERE id=?", + .placeholders = 38, .readonly = false, }, { @@ -1768,10 +1774,10 @@ struct db_query db_sqlite3_queries[] = { }, }; -#define DB_SQLITE3_QUERY_COUNT 293 +#define DB_SQLITE3_QUERY_COUNT 294 #endif /* HAVE_SQLITE3 */ #endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */ -// SHA256STAMP:3b9fa7f4f741852169761dc4172ffbd3a61c877aa6ebd07ae24e1ddb10e49f7a +// SHA256STAMP:6ab0acf78761f626e452b9d6b83206d2546872001c93779eeb2f15ff8accd62f diff --git a/wallet/statements_gettextgen.po b/wallet/statements_gettextgen.po index c13c3bae8..466a06d8f 100644 --- a/wallet/statements_gettextgen.po +++ b/wallet/statements_gettextgen.po @@ -570,67 +570,71 @@ msgstr "" msgid "ALTER TABLE payments ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);" msgstr "" -#: wallet/db.c:897 +#: wallet/db.c:671 +msgid "ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;" +msgstr "" + +#: wallet/db.c:898 msgid "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?" msgstr "" -#: wallet/db.c:997 +#: wallet/db.c:998 msgid "SELECT version FROM version LIMIT 1" msgstr "" -#: wallet/db.c:1055 +#: wallet/db.c:1056 msgid "UPDATE version SET version=?;" msgstr "" -#: wallet/db.c:1063 +#: wallet/db.c:1064 msgid "INSERT INTO db_upgrades VALUES (?, ?);" msgstr "" -#: wallet/db.c:1075 +#: wallet/db.c:1076 msgid "SELECT intval FROM vars WHERE name = 'data_version'" msgstr "" -#: wallet/db.c:1102 +#: wallet/db.c:1103 msgid "SELECT intval FROM vars WHERE name= ? LIMIT 1" msgstr "" -#: wallet/db.c:1118 +#: wallet/db.c:1119 msgid "UPDATE vars SET intval=? WHERE name=?;" msgstr "" -#: wallet/db.c:1127 +#: wallet/db.c:1128 msgid "INSERT INTO vars (name, intval) VALUES (?, ?);" msgstr "" -#: wallet/db.c:1141 +#: wallet/db.c:1142 msgid "UPDATE channels SET feerate_base = ?, feerate_ppm = ?;" msgstr "" -#: wallet/db.c:1162 +#: wallet/db.c:1163 msgid "UPDATE channels SET our_funding_satoshi = funding_satoshi WHERE funder = 0;" msgstr "" -#: wallet/db.c:1178 +#: wallet/db.c:1179 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:1240 +#: wallet/db.c:1241 msgid "UPDATE outputs SET scriptpubkey = ? WHERE prev_out_tx = ? AND prev_out_index = ?" msgstr "" -#: wallet/db.c:1265 +#: wallet/db.c:1266 msgid "SELECT id, funding_tx_id, funding_tx_outnum FROM channels;" msgstr "" -#: wallet/db.c:1284 +#: wallet/db.c:1285 msgid "UPDATE channels SET full_channel_id = ? WHERE id = ?;" msgstr "" -#: wallet/db.c:1307 +#: wallet/db.c:1308 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:1374 +#: wallet/db.c:1375 msgid "UPDATE channels SET last_tx = ? WHERE id = ?;" msgstr "" @@ -778,383 +782,383 @@ msgstr "" msgid "SELECT hstate, feerate_per_kw FROM channel_feerates WHERE channel_id = ?" msgstr "" -#: wallet/wallet.c:1136 +#: wallet/wallet.c:1137 msgid "SELECT id FROM channels ORDER BY id DESC LIMIT 1;" msgstr "" -#: wallet/wallet.c:1153 -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, funding_psbt, closer, state_change_reason FROM channels WHERE state < ?;" +#: wallet/wallet.c:1154 +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, funding_tx_remote_sigs_received, 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, funding_psbt, closer, state_change_reason FROM channels WHERE state != ?;" msgstr "" -#: wallet/wallet.c:1244 +#: wallet/wallet.c:1247 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:1249 +#: wallet/wallet.c:1252 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:1254 +#: wallet/wallet.c:1257 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:1259 +#: wallet/wallet.c:1262 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:1301 +#: wallet/wallet.c:1304 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:1330 +#: wallet/wallet.c:1333 msgid "SELECT MIN(height), MAX(height) FROM blocks;" msgstr "" -#: wallet/wallet.c:1352 +#: wallet/wallet.c:1355 msgid "INSERT INTO channel_configs DEFAULT VALUES;" msgstr "" -#: wallet/wallet.c:1364 +#: wallet/wallet.c:1367 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:1388 +#: wallet/wallet.c:1391 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:1422 +#: wallet/wallet.c:1425 msgid "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?" msgstr "" -#: wallet/wallet.c:1441 -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=?, funding_psbt=?, closer=?, state_change_reason=? WHERE id=?" +#: wallet/wallet.c:1444 +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=?, funding_tx_remote_sigs_received=?, 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=?, funding_psbt=?, closer=?, state_change_reason=? WHERE id=?" msgstr "" -#: wallet/wallet.c:1529 +#: wallet/wallet.c:1534 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:1556 +#: wallet/wallet.c:1561 msgid "DELETE FROM channel_feerates WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:1566 +#: wallet/wallet.c:1571 msgid "INSERT INTO channel_feerates VALUES(?, ?, ?)" msgstr "" -#: wallet/wallet.c:1583 +#: wallet/wallet.c:1588 msgid "UPDATE channels SET last_sent_commit=? WHERE id=?" msgstr "" -#: wallet/wallet.c:1602 +#: wallet/wallet.c:1607 msgid "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:1630 +#: wallet/wallet.c:1635 msgid "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;" msgstr "" -#: wallet/wallet.c:1659 +#: wallet/wallet.c:1664 msgid "SELECT id FROM peers WHERE node_id = ?" msgstr "" -#: wallet/wallet.c:1671 +#: wallet/wallet.c:1676 msgid "UPDATE peers SET address = ? WHERE id = ?" msgstr "" -#: wallet/wallet.c:1680 +#: wallet/wallet.c:1685 msgid "INSERT INTO peers (node_id, address) VALUES (?, ?);" msgstr "" -#: wallet/wallet.c:1698 +#: wallet/wallet.c:1703 msgid "INSERT INTO channels (peer_id, first_blocknum, id) VALUES (?, ?, ?);" msgstr "" -#: wallet/wallet.c:1724 +#: wallet/wallet.c:1729 msgid "DELETE FROM channel_htlcs WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:1730 +#: wallet/wallet.c:1735 msgid "DELETE FROM htlc_sigs WHERE channelid=?" msgstr "" -#: wallet/wallet.c:1736 +#: wallet/wallet.c:1741 msgid "DELETE FROM channeltxs WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:1742 +#: wallet/wallet.c:1747 msgid "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)" msgstr "" -#: wallet/wallet.c:1752 +#: wallet/wallet.c:1757 msgid "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?" msgstr "" -#: wallet/wallet.c:1766 +#: wallet/wallet.c:1771 msgid "SELECT * FROM channels WHERE peer_id = ?;" msgstr "" -#: wallet/wallet.c:1774 +#: wallet/wallet.c:1779 msgid "DELETE FROM peers WHERE id=?" msgstr "" -#: wallet/wallet.c:1785 +#: wallet/wallet.c:1790 msgid "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?" msgstr "" -#: wallet/wallet.c:1888 +#: wallet/wallet.c:1893 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:1941 +#: wallet/wallet.c:1946 msgid "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, origin_htlc, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, routing_onion, partid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:2001 +#: wallet/wallet.c:2006 msgid "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?" msgstr "" -#: wallet/wallet.c:2217 +#: wallet/wallet.c:2222 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:2264 +#: wallet/wallet.c:2269 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:2395 +#: wallet/wallet.c:2400 msgid "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;" msgstr "" -#: wallet/wallet.c:2429 +#: wallet/wallet.c:2434 msgid "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;" msgstr "" -#: wallet/wallet.c:2482 +#: wallet/wallet.c:2487 msgid "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;" msgstr "" -#: wallet/wallet.c:2500 +#: wallet/wallet.c:2505 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:2589 +#: wallet/wallet.c:2594 msgid "DELETE FROM payments WHERE payment_hash = ? AND partid = ?" msgstr "" -#: wallet/wallet.c:2603 +#: wallet/wallet.c:2608 msgid "DELETE FROM payments WHERE payment_hash = ?" msgstr "" -#: wallet/wallet.c:2704 +#: wallet/wallet.c:2709 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:2754 +#: wallet/wallet.c:2759 msgid "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?" msgstr "" -#: wallet/wallet.c:2764 +#: wallet/wallet.c:2769 msgid "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?" msgstr "" -#: wallet/wallet.c:2774 +#: wallet/wallet.c:2779 msgid "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;" msgstr "" -#: wallet/wallet.c:2806 +#: wallet/wallet.c:2811 msgid "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;" msgstr "" -#: wallet/wallet.c:2873 +#: wallet/wallet.c:2878 msgid "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;" msgstr "" -#: wallet/wallet.c:2932 +#: 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 = ?;" msgstr "" -#: wallet/wallet.c:2954 +#: wallet/wallet.c:2959 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:3005 +#: wallet/wallet.c:3010 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:3050 +#: wallet/wallet.c:3055 msgid "DELETE FROM htlc_sigs WHERE channelid = ?" msgstr "" -#: wallet/wallet.c:3057 +#: wallet/wallet.c:3062 msgid "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)" msgstr "" -#: wallet/wallet.c:3069 +#: wallet/wallet.c:3074 msgid "SELECT blobval FROM vars WHERE name='genesis_hash'" msgstr "" -#: wallet/wallet.c:3093 +#: wallet/wallet.c:3098 msgid "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);" msgstr "" -#: wallet/wallet.c:3111 +#: wallet/wallet.c:3116 msgid "SELECT txid, outnum FROM utxoset WHERE spendheight < ?" msgstr "" -#: wallet/wallet.c:3123 +#: wallet/wallet.c:3128 msgid "DELETE FROM utxoset WHERE spendheight < ?" msgstr "" -#: wallet/wallet.c:3131 wallet/wallet.c:3245 +#: wallet/wallet.c:3136 wallet/wallet.c:3250 msgid "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);" msgstr "" -#: wallet/wallet.c:3150 +#: wallet/wallet.c:3155 msgid "DELETE FROM blocks WHERE hash = ?" msgstr "" -#: wallet/wallet.c:3156 +#: wallet/wallet.c:3161 msgid "SELECT * FROM blocks WHERE height >= ?;" msgstr "" -#: wallet/wallet.c:3165 +#: wallet/wallet.c:3170 msgid "DELETE FROM blocks WHERE height > ?" msgstr "" -#: wallet/wallet.c:3177 +#: wallet/wallet.c:3182 msgid "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?" msgstr "" -#: wallet/wallet.c:3195 +#: wallet/wallet.c:3200 msgid "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?" msgstr "" -#: wallet/wallet.c:3218 wallet/wallet.c:3256 +#: wallet/wallet.c:3223 wallet/wallet.c:3261 msgid "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:3282 +#: wallet/wallet.c:3287 msgid "SELECT height FROM blocks WHERE height = ?" msgstr "" -#: wallet/wallet.c:3295 +#: wallet/wallet.c:3300 msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL" msgstr "" -#: wallet/wallet.c:3337 +#: wallet/wallet.c:3342 msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?" msgstr "" -#: wallet/wallet.c:3368 wallet/wallet.c:3528 +#: wallet/wallet.c:3373 wallet/wallet.c:3533 msgid "SELECT blockheight FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3378 +#: wallet/wallet.c:3383 msgid "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:3399 +#: wallet/wallet.c:3404 msgid "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?" msgstr "" -#: wallet/wallet.c:3416 +#: wallet/wallet.c:3421 msgid "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;" msgstr "" -#: wallet/wallet.c:3448 +#: wallet/wallet.c:3453 msgid "SELECT type, channel_id FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3464 +#: wallet/wallet.c:3469 msgid "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?" msgstr "" -#: wallet/wallet.c:3483 +#: wallet/wallet.c:3488 msgid "SELECT type FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3506 +#: wallet/wallet.c:3511 msgid "SELECT rawtx FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3552 +#: wallet/wallet.c:3557 msgid "SELECT blockheight, txindex FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3580 +#: wallet/wallet.c:3585 msgid "SELECT id FROM transactions WHERE blockheight=?" msgstr "" -#: wallet/wallet.c:3599 +#: wallet/wallet.c:3604 msgid "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:3623 +#: wallet/wallet.c:3628 msgid "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;" msgstr "" -#: wallet/wallet.c:3644 +#: wallet/wallet.c:3649 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:3689 +#: wallet/wallet.c:3694 msgid "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?" msgstr "" -#: wallet/wallet.c:3747 +#: wallet/wallet.c:3752 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:3806 +#: wallet/wallet.c:3811 msgid "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;" msgstr "" -#: wallet/wallet.c:3830 +#: wallet/wallet.c:3835 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)" msgstr "" -#: wallet/wallet.c:3918 +#: wallet/wallet.c:3923 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:4012 +#: wallet/wallet.c:4017 msgid "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:4037 +#: wallet/wallet.c:4042 msgid "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?" msgstr "" -#: wallet/wallet.c:4061 +#: wallet/wallet.c:4066 msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?" msgstr "" -#: wallet/wallet.c:4079 +#: wallet/wallet.c:4084 msgid "SELECT 1 FROM offers WHERE offer_id = ?;" msgstr "" -#: wallet/wallet.c:4092 +#: wallet/wallet.c:4097 msgid "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:4119 +#: wallet/wallet.c:4124 msgid "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;" msgstr "" -#: wallet/wallet.c:4147 +#: wallet/wallet.c:4152 msgid "SELECT offer_id FROM offers;" msgstr "" -#: wallet/wallet.c:4173 +#: wallet/wallet.c:4178 msgid "UPDATE offers SET status=? WHERE offer_id = ?;" msgstr "" -#: wallet/wallet.c:4184 +#: wallet/wallet.c:4189 msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;" msgstr "" -#: wallet/wallet.c:4212 +#: wallet/wallet.c:4217 msgid "SELECT status FROM offers WHERE offer_id = ?;" msgstr "" @@ -1169,4 +1173,4 @@ msgstr "" #: wallet/test/run-wallet.c:1384 msgid "INSERT INTO channels (id) VALUES (1);" msgstr "" -# SHA256STAMP:0d63ab43490ebe25d3e24ffbd0f1d837146e346443b6797cbc7976f10996a199 +# SHA256STAMP:21482a898c9a9a83ab6cd873e120306701f76f8559a2e8cb93f062a532aec3b6 diff --git a/wallet/wallet.c b/wallet/wallet.c index f99cdfbdc..a8cd2a653 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -990,15 +990,15 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm scid = NULL; } - ok &= wallet_shachain_load(w, db_column_u64(stmt, 29), &wshachain); + ok &= wallet_shachain_load(w, db_column_u64(stmt, 30), &wshachain); - remote_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 30, u8); - local_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 49, u8); + remote_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 31, u8); + local_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 50, u8); /* Do we have a last_sent_commit, if yes, populate */ - if (!db_column_is_null(stmt, 43)) { - const u8 *cursor = db_column_blob(stmt, 43); - size_t len = db_column_bytes(stmt, 43); + if (!db_column_is_null(stmt, 44)) { + const u8 *cursor = db_column_blob(stmt, 44); + size_t len = db_column_bytes(stmt, 44); size_t n = 0; last_sent_commit = tal_arr(tmpctx, struct changed_htlc, n); while (len) { @@ -1010,16 +1010,16 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm last_sent_commit = NULL; #ifdef COMPAT_V060 - if (!last_sent_commit && !db_column_is_null(stmt, 32)) { + if (!last_sent_commit && !db_column_is_null(stmt, 33)) { last_sent_commit = tal(tmpctx, struct changed_htlc); - last_sent_commit->newstate = db_column_u64(stmt, 32); - last_sent_commit->id = db_column_u64(stmt, 33); + last_sent_commit->newstate = db_column_u64(stmt, 33); + last_sent_commit->id = db_column_u64(stmt, 34); } #endif - if (!db_column_is_null(stmt, 42)) { + if (!db_column_is_null(stmt, 43)) { future_per_commitment_point = tal(tmpctx, struct pubkey); - db_column_pubkey(stmt, 42, future_per_commitment_point); + db_column_pubkey(stmt, 43, future_per_commitment_point); } else future_per_commitment_point = NULL; @@ -1027,17 +1027,17 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm channel_config_id = db_column_u64(stmt, 4); ok &= wallet_channel_config_load(w, channel_config_id, &our_config); db_column_sha256d(stmt, 13, &funding_txid.shad); - ok &= db_column_signature(stmt, 35, &last_sig.s); + ok &= db_column_signature(stmt, 36, &last_sig.s); last_sig.sighash_type = SIGHASH_ALL; /* Populate channel_info */ - db_column_pubkey(stmt, 20, &channel_info.remote_fundingkey); - db_column_pubkey(stmt, 21, &channel_info.theirbase.revocation); - db_column_pubkey(stmt, 22, &channel_info.theirbase.payment); - db_column_pubkey(stmt, 23, &channel_info.theirbase.htlc); - db_column_pubkey(stmt, 24, &channel_info.theirbase.delayed_payment); - db_column_pubkey(stmt, 25, &channel_info.remote_per_commit); - db_column_pubkey(stmt, 26, &channel_info.old_remote_per_commit); + db_column_pubkey(stmt, 21, &channel_info.remote_fundingkey); + db_column_pubkey(stmt, 22, &channel_info.theirbase.revocation); + db_column_pubkey(stmt, 23, &channel_info.theirbase.payment); + db_column_pubkey(stmt, 24, &channel_info.theirbase.htlc); + db_column_pubkey(stmt, 25, &channel_info.theirbase.delayed_payment); + db_column_pubkey(stmt, 26, &channel_info.remote_per_commit); + db_column_pubkey(stmt, 27, &channel_info.old_remote_per_commit); wallet_channel_config_load(w, db_column_u64(stmt, 5), &channel_info.their_config); @@ -1054,7 +1054,7 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm return NULL; } - final_key_idx = db_column_u64(stmt, 31); + final_key_idx = db_column_u64(stmt, 32); if (final_key_idx < 0) { log_broken(w->log, "%s: Final key < 0", __func__); return NULL; @@ -1065,13 +1065,13 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm db_column_amount_sat(stmt, 15, &funding_sat); db_column_amount_sat(stmt, 16, &our_funding_sat); - db_column_amount_msat(stmt, 18, &push_msat); - db_column_amount_msat(stmt, 19, &our_msat); - db_column_amount_msat(stmt, 40, &msat_to_us_min); - db_column_amount_msat(stmt, 41, &msat_to_us_max); + db_column_amount_msat(stmt, 19, &push_msat); + db_column_amount_msat(stmt, 20, &our_msat); + db_column_amount_msat(stmt, 41, &msat_to_us_min); + db_column_amount_msat(stmt, 42, &msat_to_us_max); - if (!db_column_is_null(stmt, 50)) { - psbt = db_column_psbt(tmpctx, stmt, 50); + if (!db_column_is_null(stmt, 51)) { + psbt = db_column_psbt(tmpctx, stmt, 51); } else psbt = NULL; @@ -1093,38 +1093,39 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm push_msat, our_funding_sat, db_column_int(stmt, 17) != 0, + db_column_int(stmt, 18) != 0, scid, &cid, our_msat, msat_to_us_min, /* msatoshi_to_us_min */ msat_to_us_max, /* msatoshi_to_us_max */ - db_column_psbt_to_tx(tmpctx, stmt, 34), + db_column_psbt_to_tx(tmpctx, stmt, 35), &last_sig, wallet_htlc_sigs_load(tmpctx, w, db_column_u64(stmt, 0), - db_column_int(stmt, 48)), + db_column_int(stmt, 49)), &channel_info, take(fee_states), remote_shutdown_scriptpubkey, local_shutdown_scriptpubkey, final_key_idx, - db_column_int(stmt, 36) != 0, + db_column_int(stmt, 37) != 0, last_sent_commit, - db_column_u64(stmt, 37), - db_column_int(stmt, 38), + db_column_u64(stmt, 38), db_column_int(stmt, 39), + db_column_int(stmt, 40), /* Not connected */ false, &local_basepoints, &local_funding_pubkey, future_per_commitment_point, - db_column_int(stmt, 44), db_column_int(stmt, 45), - db_column_arr(tmpctx, stmt, 46, u8), - db_column_int(stmt, 47), + db_column_int(stmt, 46), + db_column_arr(tmpctx, stmt, 47, u8), db_column_int(stmt, 48), + db_column_int(stmt, 49), psbt, - db_column_int(stmt, 51), - db_column_int(stmt, 52)); + db_column_int(stmt, 52), + db_column_int(stmt, 53)); return chan; } @@ -1151,60 +1152,62 @@ static bool wallet_channels_load_active(struct wallet *w) /* We load all channels */ stmt = db_prepare_v2(w->db, SQL("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" + " id" // 0 + ", peer_id" // 1 + ", short_channel_id" // 2 + ", full_channel_id" // 3 + ", channel_config_local" // 4 + ", channel_config_remote" // 5 + ", state" // 6 + ", funder" // 7 + ", channel_flags" // 8 + ", minimum_depth" // 9 + ", next_index_local" // 10 + ", next_index_remote" // 11 + ", next_htlc_id" // 12 + ", funding_tx_id" // 13 + ", funding_tx_outnum" // 14 + ", funding_satoshi" // 15 + ", our_funding_satoshi" // 16 + ", funding_locked_remote" // 17 + ", funding_tx_remote_sigs_received" // 18 + ", push_msatoshi" // 19 + ", msatoshi_local" // 20 + ", fundingkey_remote" // 21 + ", revocation_basepoint_remote" // 22 + ", payment_basepoint_remote" // 23 + ", htlc_basepoint_remote" // 24 ", 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" - ", funding_psbt" - ", closer" - ", state_change_reason" - " FROM channels WHERE state < ?;")); + ", per_commit_remote" // 26 + ", old_per_commit_remote" // 27 + ", local_feerate_per_kw" // 28 + ", remote_feerate_per_kw" // 29 + ", shachain_remote_id" // 30 + ", shutdown_scriptpubkey_remote" // 31 + ", shutdown_keyidx_local" // 32 + ", last_sent_commit_state" // 33 + ", last_sent_commit_id" // 34 + ", last_tx" // 35 + ", last_sig" // 36 + ", last_was_revoke" // 37 + ", first_blocknum" // 38 + ", min_possible_feerate" // 39 + ", max_possible_feerate" // 40 + ", msatoshi_to_us_min" // 41 + ", msatoshi_to_us_max" // 42 + ", future_per_commitment_point" // 43 + ", last_sent_commit" // 44 + ", feerate_base" // 45 + ", feerate_ppm" // 46 + ", remote_upfront_shutdown_script" // 47 + ", option_static_remotekey" // 48 + ", option_anchor_outputs" // 49 + ", shutdown_scriptpubkey_local" // 50 + ", funding_psbt" // 51 + ", closer" // 52 + ", state_change_reason" // 53 + " FROM channels" + " WHERE state != ?;")); //? 0 db_bind_int(stmt, 0, CLOSED); db_query_prepared(stmt); @@ -1439,42 +1442,43 @@ void wallet_channel_save(struct wallet *w, struct channel *chan) wallet_channel_config_save(w, &chan->our_config); stmt = db_prepare_v2(w->db, SQL("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=?," + " shachain_remote_id=?," // 0 + " short_channel_id=?," // 1 + " full_channel_id=?," // 2 + " state=?," // 3 + " funder=?," // 4 + " channel_flags=?," // 5 + " minimum_depth=?," // 6 + " next_index_local=?," // 7 + " next_index_remote=?," // 8 + " next_htlc_id=?," // 9 + " funding_tx_id=?," // 10 + " funding_tx_outnum=?," // 11 + " funding_satoshi=?," // 12 + " our_funding_satoshi=?," // 13 + " funding_locked_remote=?," // 14 + " funding_tx_remote_sigs_received=?," // 15 + " push_msatoshi=?," // 16 + " msatoshi_local=?," // 17 " 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=?," + " shutdown_keyidx_local=?," // 19 + " channel_config_local=?," // 20 + " last_tx=?, last_sig=?," // 21 + 22 + " last_was_revoke=?," // 23 + " min_possible_feerate=?," // 24 + " max_possible_feerate=?," // 25 + " msatoshi_to_us_min=?," // 26 + " msatoshi_to_us_max=?," // 27 + " feerate_base=?," // 28 + " feerate_ppm=?," // 29 " remote_upfront_shutdown_script=?," - " option_static_remotekey=?," - " option_anchor_outputs=?," - " shutdown_scriptpubkey_local=?," - " funding_psbt=?," - " closer=?," - " state_change_reason=?" - " WHERE id=?")); + " option_static_remotekey=?," // 31 + " option_anchor_outputs=?," // 32 + " shutdown_scriptpubkey_local=?," // 33 + " funding_psbt=?," // 34 + " closer=?," // 35 + " state_change_reason=?" // 36 + " WHERE id=?")); // 37 db_bind_u64(stmt, 0, chan->their_shachain.id); if (chan->scid) db_bind_short_channel_id(stmt, 1, chan->scid); @@ -1497,32 +1501,33 @@ void wallet_channel_save(struct wallet *w, struct channel *chan) db_bind_amount_sat(stmt, 12, &chan->funding); db_bind_amount_sat(stmt, 13, &chan->our_funds); db_bind_int(stmt, 14, chan->remote_funding_locked); - db_bind_amount_msat(stmt, 15, &chan->push); - db_bind_amount_msat(stmt, 16, &chan->our_msat); + db_bind_int(stmt, 15, chan->remote_tx_sigs); + db_bind_amount_msat(stmt, 16, &chan->push); + db_bind_amount_msat(stmt, 17, &chan->our_msat); - db_bind_talarr(stmt, 17, chan->shutdown_scriptpubkey[REMOTE]); - db_bind_u64(stmt, 18, chan->final_key_idx); - db_bind_u64(stmt, 19, chan->our_config.id); - db_bind_psbt(stmt, 20, chan->last_tx->psbt); - db_bind_signature(stmt, 21, &chan->last_sig.s); - db_bind_int(stmt, 22, chan->last_was_revoke); - db_bind_int(stmt, 23, chan->min_possible_feerate); - db_bind_int(stmt, 24, chan->max_possible_feerate); - db_bind_amount_msat(stmt, 25, &chan->msat_to_us_min); - db_bind_amount_msat(stmt, 26, &chan->msat_to_us_max); - db_bind_int(stmt, 27, chan->feerate_base); - db_bind_int(stmt, 28, chan->feerate_ppm); - db_bind_talarr(stmt, 29, chan->remote_upfront_shutdown_script); - db_bind_int(stmt, 30, chan->option_static_remotekey); - db_bind_int(stmt, 31, chan->option_anchor_outputs); - db_bind_talarr(stmt, 32, chan->shutdown_scriptpubkey[LOCAL]); + db_bind_talarr(stmt, 18, chan->shutdown_scriptpubkey[REMOTE]); + db_bind_u64(stmt, 19, chan->final_key_idx); + db_bind_u64(stmt, 20, chan->our_config.id); + db_bind_psbt(stmt, 21, chan->last_tx->psbt); + db_bind_signature(stmt, 22, &chan->last_sig.s); + db_bind_int(stmt, 23, chan->last_was_revoke); + db_bind_int(stmt, 24, chan->min_possible_feerate); + db_bind_int(stmt, 25, chan->max_possible_feerate); + db_bind_amount_msat(stmt, 26, &chan->msat_to_us_min); + db_bind_amount_msat(stmt, 27, &chan->msat_to_us_max); + db_bind_int(stmt, 28, chan->feerate_base); + db_bind_int(stmt, 29, chan->feerate_ppm); + db_bind_talarr(stmt, 30, chan->remote_upfront_shutdown_script); + db_bind_int(stmt, 31, chan->option_static_remotekey); + db_bind_int(stmt, 32, chan->option_anchor_outputs); + db_bind_talarr(stmt, 33, chan->shutdown_scriptpubkey[LOCAL]); if (chan->psbt) - db_bind_psbt(stmt, 33, chan->psbt); + db_bind_psbt(stmt, 34, chan->psbt); else - db_bind_null(stmt, 33); - db_bind_int(stmt, 34, chan->closer); - db_bind_int(stmt, 35, chan->state_change_cause); - db_bind_u64(stmt, 36, chan->dbid); + db_bind_null(stmt, 34); + db_bind_int(stmt, 35, chan->closer); + db_bind_int(stmt, 36, chan->state_change_cause); + db_bind_u64(stmt, 37, chan->dbid); db_exec_prepared_v2(take(stmt)); wallet_channel_config_save(w, &chan->channel_info.their_config);