wallet: save thresholds for option_static_remotekey.

Since we will soon be able to activate it on existing channels,
we need to mark the threshold.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-06-04 14:43:47 +09:30
parent d305b8ada6
commit 220b6129bf
13 changed files with 270 additions and 199 deletions

View File

@ -3353,6 +3353,9 @@ static void init_channel(struct peer *peer)
master_badmsg(WIRE_CHANNELD_INIT, msg);
}
status_debug("option_static_remotekey = %u, option_anchor_outputs = %u",
option_static_remotekey, option_anchor_outputs);
/* Keeping an array of pointers is better since it allows us to avoid
* extra allocations later. */
peer->pbases = tal_arr(peer, struct penalty_base *, 0);

View File

@ -263,7 +263,8 @@ struct channel *new_unsaved_channel(struct peer *peer,
* | Use v2 of channel open, enables dual funding
* | IN9
* | `option_anchor_outputs` */
channel->option_static_remotekey = true;
channel->static_remotekey_start[LOCAL]
= channel->static_remotekey_start[REMOTE] = 0;
channel->option_anchor_outputs = true;
channel->future_per_commitment_point = NULL;
@ -334,7 +335,8 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
u32 feerate_base,
u32 feerate_ppm,
const u8 *remote_upfront_shutdown_script,
bool option_static_remotekey,
u64 local_static_remotekey_start,
u64 remote_static_remotekey_start,
bool option_anchor_outputs,
enum side closer,
enum state_change reason,
@ -423,7 +425,8 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
channel->feerate_ppm = feerate_ppm;
channel->remote_upfront_shutdown_script
= tal_steal(channel, remote_upfront_shutdown_script);
channel->option_static_remotekey = option_static_remotekey;
channel->static_remotekey_start[LOCAL] = local_static_remotekey_start;
channel->static_remotekey_start[REMOTE] = remote_static_remotekey_start;
channel->option_anchor_outputs = option_anchor_outputs;
channel->forgets = tal_arr(channel, struct command *, 0);

View File

@ -188,8 +188,8 @@ struct channel {
/* If they used option_upfront_shutdown_script. */
const u8 *remote_upfront_shutdown_script;
/* Was this negotiated with `option_static_remotekey? */
bool option_static_remotekey;
/* At what commit numbers does `option_static_remotekey` apply? */
u64 static_remotekey_start[NUM_SIDES];
/* Was this negotiated with `option_anchor_outputs? */
bool option_anchor_outputs;
@ -267,7 +267,8 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
u32 feerate_ppm,
/* NULL or stolen */
const u8 *remote_upfront_shutdown_script STEALS,
bool option_static_remotekey,
u64 local_static_remotekey_start,
u64 remote_static_remotekey_start,
bool option_anchor_outputs,
enum side closer,
enum state_change reason,

View File

@ -275,12 +275,6 @@ void channel_fallen_behind(struct channel *channel, const u8 *msg)
* use its presence as a flag so set it any valid key in that case. */
if (!channel->future_per_commitment_point) {
struct pubkey *any = tal(channel, struct pubkey);
if (!channel->option_static_remotekey) {
channel_internal_error(channel,
"bad channel_fail_fallen_behind %s",
tal_hex(tmpctx, msg));
return;
}
if (!pubkey_from_node_id(any, &channel->peer->ld->id))
fatal("Our own id invalid?");
channel->future_per_commitment_point = any;
@ -608,7 +602,7 @@ void peer_start_channeld(struct channel *channel,
remote_ann_bitcoin_sig,
/* Set at channel open, even if not
* negotiated now! */
channel->option_static_remotekey,
channel->next_index[LOCAL] >= channel->static_remotekey_start[LOCAL],
channel->option_anchor_outputs,
IFDEV(ld->dev_fast_gossip, false),
IFDEV(dev_fail_process_onionpacket, false),

View File

@ -657,6 +657,9 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
}
}
log_debug(channel->log, "channel->static_remotekey_start[LOCAL] %"PRIu64,
channel->static_remotekey_start[LOCAL]);
msg = towire_onchaind_init(channel,
&channel->their_shachain.chain,
chainparams,
@ -694,7 +697,8 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
channel->future_per_commitment_point,
&channel->local_funding_pubkey,
&channel->channel_info.remote_fundingkey,
channel->option_static_remotekey,
/* FIXME! onchaind needs start numbers! */
channel->static_remotekey_start[LOCAL] == 0,
channel->option_anchor_outputs,
is_replay,
feerate_min(ld, NULL));

View File

@ -103,7 +103,7 @@ wallet_commit_channel(struct lightningd *ld,
struct amount_msat our_msat;
struct amount_sat local_funding;
s64 final_key_idx;
bool option_static_remotekey;
u64 static_remotekey_start;
bool option_anchor_outputs;
/* We cannot both be the fundee *and* have a `fundchannel_start`
@ -153,10 +153,13 @@ wallet_commit_channel(struct lightningd *ld,
* transactions
*/
/* i.e. We set it now for the channel permanently. */
option_static_remotekey
= feature_negotiated(ld->our_features,
uc->peer->their_features,
OPT_STATIC_REMOTEKEY);
if (feature_negotiated(ld->our_features,
uc->peer->their_features,
OPT_STATIC_REMOTEKEY))
static_remotekey_start = 0;
else
static_remotekey_start = 0x7FFFFFFFFFFFFFFF;
option_anchor_outputs
= feature_negotiated(ld->our_features,
uc->peer->their_features,
@ -209,7 +212,7 @@ wallet_commit_channel(struct lightningd *ld,
ld->config.fee_base,
ld->config.fee_per_satoshi,
remote_upfront_shutdown_script,
option_static_remotekey,
static_remotekey_start, static_remotekey_start,
option_anchor_outputs,
NUM_SIDES, /* closer not yet known */
uc->fc ? REASON_USER : REASON_REMOTE,

View File

@ -848,7 +848,7 @@ static void json_add_channel(struct lightningd *ld,
json_add_null(response, "closer");
json_array_start(response, "features");
if (channel->option_static_remotekey)
if (channel->static_remotekey_start[LOCAL] != 0x7FFFFFFFFFFFFFFF)
json_add_string(response, NULL, "option_static_remotekey");
if (channel->option_anchor_outputs)
json_add_string(response, NULL, "option_anchor_outputs");

View File

@ -717,6 +717,17 @@ static struct migration dbmigrations[] = {
{SQL("ALTER TABLE channels ADD shutdown_wrong_txid BLOB DEFAULT NULL"), NULL},
{SQL("ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL"), NULL},
{NULL, migrate_inflight_last_tx_to_psbt},
/* Channels can now change their type at specific commit indexes. */
{SQL("ALTER TABLE channels ADD local_static_remotekey_start BIGINT DEFAULT 0"),
NULL},
{SQL("ALTER TABLE channels ADD remote_static_remotekey_start BIGINT DEFAULT 0"),
NULL},
/* Set counter past 2^48 if they don't have option */
{SQL("UPDATE channels SET"
" remote_static_remotekey_start = 9223372036854775807,"
" local_static_remotekey_start = 9223372036854775807"
" WHERE option_static_remotekey = 0"),
NULL},
};
/* Leak tracking. */

View File

@ -938,6 +938,24 @@ struct db_query db_postgres_queries[] = {
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD local_static_remotekey_start BIGINT DEFAULT 0",
.query = "ALTER TABLE channels ADD local_static_remotekey_start BIGINT DEFAULT 0",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD remote_static_remotekey_start BIGINT DEFAULT 0",
.query = "ALTER TABLE channels ADD remote_static_remotekey_start BIGINT DEFAULT 0",
.placeholders = 0,
.readonly = false,
},
{
.name = "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 0",
.query = "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 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",
@ -1305,8 +1323,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, 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;",
.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, 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 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, 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 FROM channels WHERE state != $1;",
.placeholders = 1,
.readonly = true,
},
@ -1371,9 +1389,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=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? 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, closer=$34, state_change_reason=$35, shutdown_wrong_txid=$36, shutdown_wrong_outnum=$37 WHERE id=$38",
.placeholders = 38,
.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=?, local_static_remotekey_start=?, remote_static_remotekey_start=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? 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, local_static_remotekey_start=$31, remote_static_remotekey_start=$32, option_anchor_outputs=$33, shutdown_scriptpubkey_local=$34, closer=$35, state_change_reason=$36, shutdown_wrong_txid=$37, shutdown_wrong_outnum=$38 WHERE id=$39",
.placeholders = 39,
.readonly = false,
},
{
@ -1900,10 +1918,10 @@ struct db_query db_postgres_queries[] = {
},
};
#define DB_POSTGRES_QUERY_COUNT 315
#define DB_POSTGRES_QUERY_COUNT 318
#endif /* HAVE_POSTGRES */
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
// SHA256STAMP:2839b3ea02654d43cce04742850e4c42541818c1641ab5119f077d859a288e5a
// SHA256STAMP:8881af1d864eeb8541b44a9dbbd48b8be848146d60ef45011e91c6e3009e9c75

View File

@ -938,6 +938,24 @@ struct db_query db_sqlite3_queries[] = {
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD local_static_remotekey_start BIGINT DEFAULT 0",
.query = "ALTER TABLE channels ADD local_static_remotekey_start INTEGER DEFAULT 0",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD remote_static_remotekey_start BIGINT DEFAULT 0",
.query = "ALTER TABLE channels ADD remote_static_remotekey_start INTEGER DEFAULT 0",
.placeholders = 0,
.readonly = false,
},
{
.name = "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 0",
.query = "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 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 = ?",
@ -1305,8 +1323,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, 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 != ?;",
.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, 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 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, 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 FROM channels WHERE state != ?;",
.placeholders = 1,
.readonly = true,
},
@ -1371,9 +1389,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=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? 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=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? WHERE id=?",
.placeholders = 38,
.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=?, local_static_remotekey_start=?, remote_static_remotekey_start=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? 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=?, local_static_remotekey_start=?, remote_static_remotekey_start=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? WHERE id=?",
.placeholders = 39,
.readonly = false,
},
{
@ -1900,10 +1918,10 @@ struct db_query db_sqlite3_queries[] = {
},
};
#define DB_SQLITE3_QUERY_COUNT 315
#define DB_SQLITE3_QUERY_COUNT 318
#endif /* HAVE_SQLITE3 */
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
// SHA256STAMP:2839b3ea02654d43cce04742850e4c42541818c1641ab5119f077d859a288e5a
// SHA256STAMP:8881af1d864eeb8541b44a9dbbd48b8be848146d60ef45011e91c6e3009e9c75

View File

@ -618,83 +618,95 @@ msgstr ""
msgid "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL"
msgstr ""
#: wallet/db.c:946
#: wallet/db.c:721
msgid "ALTER TABLE channels ADD local_static_remotekey_start BIGINT DEFAULT 0"
msgstr ""
#: wallet/db.c:723
msgid "ALTER TABLE channels ADD remote_static_remotekey_start BIGINT DEFAULT 0"
msgstr ""
#: wallet/db.c:726
msgid "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 0"
msgstr ""
#: wallet/db.c:957
msgid "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?"
msgstr ""
#: wallet/db.c:1046
#: wallet/db.c:1057
msgid "SELECT version FROM version LIMIT 1"
msgstr ""
#: wallet/db.c:1108
#: wallet/db.c:1119
msgid "UPDATE version SET version=?;"
msgstr ""
#: wallet/db.c:1116
#: wallet/db.c:1127
msgid "INSERT INTO db_upgrades VALUES (?, ?);"
msgstr ""
#: wallet/db.c:1128
#: wallet/db.c:1139
msgid "SELECT intval FROM vars WHERE name = 'data_version'"
msgstr ""
#: wallet/db.c:1155
#: wallet/db.c:1166
msgid "SELECT intval FROM vars WHERE name= ? LIMIT 1"
msgstr ""
#: wallet/db.c:1171
#: wallet/db.c:1182
msgid "UPDATE vars SET intval=? WHERE name=?;"
msgstr ""
#: wallet/db.c:1180
#: wallet/db.c:1191
msgid "INSERT INTO vars (name, intval) VALUES (?, ?);"
msgstr ""
#: wallet/db.c:1194
#: wallet/db.c:1205
msgid "UPDATE channels SET feerate_base = ?, feerate_ppm = ?;"
msgstr ""
#: wallet/db.c:1215
#: wallet/db.c:1226
msgid "UPDATE channels SET our_funding_satoshi = funding_satoshi WHERE funder = 0;"
msgstr ""
#: wallet/db.c:1231
#: wallet/db.c:1242
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:1293
#: wallet/db.c:1304
msgid "UPDATE outputs SET scriptpubkey = ? WHERE prev_out_tx = ? AND prev_out_index = ?"
msgstr ""
#: wallet/db.c:1318
#: wallet/db.c:1329
msgid "SELECT id, funding_tx_id, funding_tx_outnum FROM channels;"
msgstr ""
#: wallet/db.c:1337
#: wallet/db.c:1348
msgid "UPDATE channels SET full_channel_id = ? WHERE id = ?;"
msgstr ""
#: wallet/db.c:1358
#: wallet/db.c:1369
msgid "SELECT channels.id, peers.node_id FROM channels JOIN peers ON (peers.id = channels.peer_id)"
msgstr ""
#: wallet/db.c:1391
#: wallet/db.c:1402
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:1417
#: wallet/db.c:1428
msgid "SELECT c.id, p.node_id, c.fundingkey_remote, inflight.last_tx, inflight.last_sig, inflight.funding_satoshi, inflight.funding_tx_id FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id LEFT OUTER JOIN channel_funding_inflights inflight ON c.id = inflight.channel_id WHERE inflight.last_tx IS NOT NULL;"
msgstr ""
#: wallet/db.c:1484
#: wallet/db.c:1495
msgid "UPDATE channel_funding_inflights SET last_tx = ? WHERE channel_id = ? AND funding_tx_id = ?;"
msgstr ""
#: wallet/db.c:1508
#: wallet/db.c:1519
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:1575
#: wallet/db.c:1586
msgid "UPDATE channels SET last_tx = ? WHERE id = ?;"
msgstr ""
@ -858,387 +870,387 @@ msgstr ""
msgid "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate"
msgstr ""
#: wallet/wallet.c:1308
#: wallet/wallet.c:1309
msgid "SELECT id FROM channels ORDER BY id DESC LIMIT 1;"
msgstr ""
#: wallet/wallet.c:1325
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 != ?;"
#: wallet/wallet.c:1326
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 FROM channels WHERE state != ?;"
msgstr ""
#: wallet/wallet.c:1432
#: wallet/wallet.c:1434
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:1438
#: wallet/wallet.c:1440
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:1444
#: wallet/wallet.c:1446
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:1450
#: wallet/wallet.c:1452
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:1495
#: wallet/wallet.c:1497
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:1524
#: wallet/wallet.c:1526
msgid "SELECT MIN(height), MAX(height) FROM blocks;"
msgstr ""
#: wallet/wallet.c:1546
#: wallet/wallet.c:1548
msgid "INSERT INTO channel_configs DEFAULT VALUES;"
msgstr ""
#: wallet/wallet.c:1558
#: wallet/wallet.c:1560
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:1582
#: wallet/wallet.c:1584
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:1616
#: wallet/wallet.c:1618
msgid "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1635
msgid "UPDATE channels SET shachain_remote_id=?, short_channel_id=?, full_channel_id=?, state=?, funder=?, channel_flags=?, minimum_depth=?, next_index_local=?, next_index_remote=?, next_htlc_id=?, funding_tx_id=?, funding_tx_outnum=?, funding_satoshi=?, our_funding_satoshi=?, funding_locked_remote=?, push_msatoshi=?, msatoshi_local=?, shutdown_scriptpubkey_remote=?, shutdown_keyidx_local=?, channel_config_local=?, last_tx=?, last_sig=?, last_was_revoke=?, min_possible_feerate=?, max_possible_feerate=?, msatoshi_to_us_min=?, msatoshi_to_us_max=?, feerate_base=?, feerate_ppm=?, remote_upfront_shutdown_script=?, option_static_remotekey=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? WHERE id=?"
#: wallet/wallet.c:1637
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=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1727
#: wallet/wallet.c:1731
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:1754
#: wallet/wallet.c:1758
msgid "DELETE FROM channel_feerates WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1764
#: wallet/wallet.c:1768
msgid "INSERT INTO channel_feerates VALUES(?, ?, ?)"
msgstr ""
#: wallet/wallet.c:1781
#: wallet/wallet.c:1785
msgid "UPDATE channels SET last_sent_commit=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1804
#: wallet/wallet.c:1808
msgid "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:1832
#: wallet/wallet.c:1836
msgid "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;"
msgstr ""
#: wallet/wallet.c:1861
#: wallet/wallet.c:1865
msgid "SELECT id FROM peers WHERE node_id = ?"
msgstr ""
#: wallet/wallet.c:1873
#: wallet/wallet.c:1877
msgid "UPDATE peers SET address = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:1882
#: wallet/wallet.c:1886
msgid "INSERT INTO peers (node_id, address) VALUES (?, ?);"
msgstr ""
#: wallet/wallet.c:1903
#: wallet/wallet.c:1907
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:1944
#: wallet/wallet.c:1948
msgid "DELETE FROM channel_htlcs WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1950
#: wallet/wallet.c:1954
msgid "DELETE FROM htlc_sigs WHERE channelid=?"
msgstr ""
#: wallet/wallet.c:1956
#: wallet/wallet.c:1960
msgid "DELETE FROM channeltxs WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1963
#: wallet/wallet.c:1967
msgid "DELETE FROM channel_funding_inflights WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1969
#: wallet/wallet.c:1973
msgid "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)"
msgstr ""
#: wallet/wallet.c:1979
#: wallet/wallet.c:1983
msgid "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?"
msgstr ""
#: wallet/wallet.c:1993
#: wallet/wallet.c:1997
msgid "SELECT * FROM channels WHERE peer_id = ?;"
msgstr ""
#: wallet/wallet.c:2001
#: wallet/wallet.c:2005
msgid "DELETE FROM peers WHERE id=?"
msgstr ""
#: wallet/wallet.c:2012
#: wallet/wallet.c:2016
msgid "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?"
msgstr ""
#: wallet/wallet.c:2115
#: wallet/wallet.c:2119
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:2168
#: wallet/wallet.c:2172
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:2229
#: wallet/wallet.c:2233
msgid "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:2445
#: wallet/wallet.c:2449
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:2492
#: wallet/wallet.c:2496
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:2623
#: wallet/wallet.c:2627
msgid "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;"
msgstr ""
#: wallet/wallet.c:2657
#: wallet/wallet.c:2661
msgid "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2710
#: wallet/wallet.c:2714
msgid "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2728
#: wallet/wallet.c:2732
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:2817
#: wallet/wallet.c:2821
msgid "DELETE FROM payments WHERE payment_hash = ? AND partid = ?"
msgstr ""
#: wallet/wallet.c:2831
#: wallet/wallet.c:2835
msgid "DELETE FROM payments WHERE payment_hash = ?"
msgstr ""
#: wallet/wallet.c:2932
#: wallet/wallet.c:2936
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:2982
#: wallet/wallet.c:2986
msgid "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?"
msgstr ""
#: wallet/wallet.c:2992
#: wallet/wallet.c:2996
msgid "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?"
msgstr ""
#: wallet/wallet.c:3002
#: wallet/wallet.c:3006
msgid "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:3034
#: wallet/wallet.c:3038
msgid "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;"
msgstr ""
#: wallet/wallet.c:3101
#: wallet/wallet.c:3105
msgid "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;"
msgstr ""
#: wallet/wallet.c:3160
#: wallet/wallet.c:3164
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:3183
#: wallet/wallet.c:3187
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:3234
#: wallet/wallet.c:3238
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:3279
#: wallet/wallet.c:3283
msgid "DELETE FROM htlc_sigs WHERE channelid = ?"
msgstr ""
#: wallet/wallet.c:3286
#: wallet/wallet.c:3290
msgid "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)"
msgstr ""
#: wallet/wallet.c:3298
#: wallet/wallet.c:3302
msgid "SELECT blobval FROM vars WHERE name='genesis_hash'"
msgstr ""
#: wallet/wallet.c:3322
#: wallet/wallet.c:3326
msgid "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);"
msgstr ""
#: wallet/wallet.c:3340
#: wallet/wallet.c:3344
msgid "SELECT txid, outnum FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3352
#: wallet/wallet.c:3356
msgid "DELETE FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3360 wallet/wallet.c:3474
#: wallet/wallet.c:3364 wallet/wallet.c:3478
msgid "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3379
#: wallet/wallet.c:3383
msgid "DELETE FROM blocks WHERE hash = ?"
msgstr ""
#: wallet/wallet.c:3385
#: wallet/wallet.c:3389
msgid "SELECT * FROM blocks WHERE height >= ?;"
msgstr ""
#: wallet/wallet.c:3394
#: wallet/wallet.c:3398
msgid "DELETE FROM blocks WHERE height > ?"
msgstr ""
#: wallet/wallet.c:3406
#: wallet/wallet.c:3410
msgid "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?"
msgstr ""
#: wallet/wallet.c:3424
#: wallet/wallet.c:3428
msgid "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?"
msgstr ""
#: wallet/wallet.c:3447 wallet/wallet.c:3485
#: wallet/wallet.c:3451 wallet/wallet.c:3489
msgid "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3511
#: wallet/wallet.c:3515
msgid "SELECT height FROM blocks WHERE height = ?"
msgstr ""
#: wallet/wallet.c:3524
#: wallet/wallet.c:3528
msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL"
msgstr ""
#: wallet/wallet.c:3566
#: wallet/wallet.c:3570
msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?"
msgstr ""
#: wallet/wallet.c:3597 wallet/wallet.c:3757
#: wallet/wallet.c:3601 wallet/wallet.c:3761
msgid "SELECT blockheight FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3607
#: wallet/wallet.c:3611
msgid "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3628
#: wallet/wallet.c:3632
msgid "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3645
#: wallet/wallet.c:3649
msgid "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;"
msgstr ""
#: wallet/wallet.c:3677
#: wallet/wallet.c:3681
msgid "SELECT type, channel_id FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3693
#: wallet/wallet.c:3697
msgid "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3712
#: wallet/wallet.c:3716
msgid "SELECT type FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3735
#: wallet/wallet.c:3739
msgid "SELECT rawtx FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3781
#: wallet/wallet.c:3785
msgid "SELECT blockheight, txindex FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3809
#: wallet/wallet.c:3813
msgid "SELECT id FROM transactions WHERE blockheight=?"
msgstr ""
#: wallet/wallet.c:3828
#: wallet/wallet.c:3832
msgid "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3852
#: wallet/wallet.c:3856
msgid "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;"
msgstr ""
#: wallet/wallet.c:3873
#: wallet/wallet.c:3877
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:3918
#: wallet/wallet.c:3922
msgid "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?"
msgstr ""
#: wallet/wallet.c:3976
#: wallet/wallet.c:3980
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:4035
#: wallet/wallet.c:4039
msgid "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;"
msgstr ""
#: wallet/wallet.c:4084
#: wallet/wallet.c:4088
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:4206
#: wallet/wallet.c:4210
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:4300
#: wallet/wallet.c:4304
msgid "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4325
#: wallet/wallet.c:4329
msgid "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?"
msgstr ""
#: wallet/wallet.c:4349
#: wallet/wallet.c:4353
msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?"
msgstr ""
#: wallet/wallet.c:4367
#: wallet/wallet.c:4371
msgid "SELECT 1 FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4380
#: wallet/wallet.c:4384
msgid "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4407
#: wallet/wallet.c:4411
msgid "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4435
#: wallet/wallet.c:4439
msgid "SELECT offer_id FROM offers;"
msgstr ""
#: wallet/wallet.c:4461
#: wallet/wallet.c:4465
msgid "UPDATE offers SET status=? WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4472
#: wallet/wallet.c:4476
msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4500
#: wallet/wallet.c:4504
msgid "SELECT status FROM offers WHERE offer_id = ?;"
msgstr ""
@ -1257,4 +1269,4 @@ msgstr ""
#: wallet/test/run-wallet.c:1649
msgid "INSERT INTO channels (id) VALUES (1);"
msgstr ""
# SHA256STAMP:61244f420c5eefe9cf60f0599cdd6c17d38f719ed2bc5acac93ee1109f121dcf
# SHA256STAMP:16bc289317e93dbae2af010cde394060c0d5cbf610e5fcb995d6fa5ad4587bf1

View File

@ -1521,7 +1521,7 @@ static bool test_channel_inflight_crud(struct lightningd *ld, const tal_t *ctx)
&txid, 1,
funding_sats, AMOUNT_MSAT(0),
our_sats,
false, false,
0, false,
&cid,
AMOUNT_MSAT(3333333000),
AMOUNT_MSAT(33333),
@ -1540,7 +1540,7 @@ static bool test_channel_inflight_crud(struct lightningd *ld, const tal_t *ctx)
&basepoints,
&pk, NULL,
1000, 100,
NULL, true, true,
NULL, 0, 0, true,
LOCAL, REASON_UNKNOWN, NULL);
db_begin_transaction(w->db);
CHECK(!wallet_err);

View File

@ -1154,7 +1154,7 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm
ok &= wallet_shachain_load(w, db_column_u64(stmt, 29), &wshachain);
remote_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 30, u8);
local_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 49, 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)) {
@ -1222,17 +1222,17 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm
return NULL;
}
db_column_pubkey(stmt, 52, &local_basepoints.revocation);
db_column_pubkey(stmt, 53, &local_basepoints.payment);
db_column_pubkey(stmt, 54, &local_basepoints.htlc);
db_column_pubkey(stmt, 55, &local_basepoints.delayed_payment);
db_column_pubkey(stmt, 56, &local_funding_pubkey);
if (db_column_is_null(stmt, 57))
db_column_pubkey(stmt, 53, &local_basepoints.revocation);
db_column_pubkey(stmt, 54, &local_basepoints.payment);
db_column_pubkey(stmt, 55, &local_basepoints.htlc);
db_column_pubkey(stmt, 56, &local_basepoints.delayed_payment);
db_column_pubkey(stmt, 57, &local_funding_pubkey);
if (db_column_is_null(stmt, 58))
shutdown_wrong_funding = NULL;
else {
shutdown_wrong_funding = tal(tmpctx, struct bitcoin_outpoint);
db_column_txid(stmt, 57, &shutdown_wrong_funding->txid);
shutdown_wrong_funding->n = db_column_int(stmt, 58);
db_column_txid(stmt, 58, &shutdown_wrong_funding->txid);
shutdown_wrong_funding->n = db_column_int(stmt, 59);
}
db_column_amount_sat(stmt, 15, &funding_sat);
@ -1269,7 +1269,7 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm
&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,
@ -1287,10 +1287,11 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm
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, 48),
db_column_int(stmt, 50),
db_column_u64(stmt, 47),
db_column_u64(stmt, 48),
db_column_int(stmt, 49),
db_column_int(stmt, 51),
db_column_int(stmt, 52),
shutdown_wrong_funding);
if (!wallet_channel_load_inflights(w, chan)) {
@ -1370,18 +1371,19 @@ static bool wallet_channels_load_active(struct wallet *w)
", feerate_base" // 44
", feerate_ppm" // 45
", remote_upfront_shutdown_script" // 46
", option_static_remotekey" // 47
", option_anchor_outputs" // 48
", shutdown_scriptpubkey_local" // 49
", closer" // 50
", state_change_reason" // 51
", revocation_basepoint_local" // 52
", payment_basepoint_local" // 53
", htlc_basepoint_local" // 54
", delayed_payment_basepoint_local" // 55
", funding_pubkey_local" // 56
", shutdown_wrong_txid" // 57
", shutdown_wrong_outnum" // 58
", local_static_remotekey_start" // 47
", remote_static_remotekey_start" // 48
", option_anchor_outputs" // 49
", shutdown_scriptpubkey_local" // 50
", closer" // 51
", state_change_reason" // 52
", revocation_basepoint_local" // 53
", payment_basepoint_local" // 54
", htlc_basepoint_local" // 55
", delayed_payment_basepoint_local" // 56
", funding_pubkey_local" // 57
", shutdown_wrong_txid" // 58
", shutdown_wrong_outnum" // 59
" FROM channels"
" WHERE state != ?;")); //? 0
db_bind_int(stmt, 0, CLOSED);
@ -1661,15 +1663,16 @@ void wallet_channel_save(struct wallet *w, struct channel *chan)
" msatoshi_to_us_max=?," // 26
" feerate_base=?," // 27
" feerate_ppm=?," // 28
" remote_upfront_shutdown_script=?,"
" option_static_remotekey=?," // 30
" option_anchor_outputs=?," // 31
" shutdown_scriptpubkey_local=?," // 32
" closer=?," // 33
" state_change_reason=?," // 34
" shutdown_wrong_txid=?," // 35
" shutdown_wrong_outnum=?" // 36
" WHERE id=?")); // 37
" remote_upfront_shutdown_script=?," // 29
" local_static_remotekey_start=?," // 30
" remote_static_remotekey_start=?," // 31
" option_anchor_outputs=?," // 32
" shutdown_scriptpubkey_local=?," // 33
" closer=?," // 34
" state_change_reason=?," // 35
" shutdown_wrong_txid=?," // 36
" shutdown_wrong_outnum=?" // 37
" WHERE id=?")); // 38
db_bind_u64(stmt, 0, chan->their_shachain.id);
if (chan->scid)
db_bind_short_channel_id(stmt, 1, chan->scid);
@ -1708,19 +1711,20 @@ void wallet_channel_save(struct wallet *w, struct channel *chan)
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_int(stmt, 33, chan->closer);
db_bind_int(stmt, 34, chan->state_change_cause);
db_bind_u64(stmt, 30, chan->static_remotekey_start[LOCAL]);
db_bind_u64(stmt, 31, chan->static_remotekey_start[REMOTE]);
db_bind_int(stmt, 32, chan->option_anchor_outputs);
db_bind_talarr(stmt, 33, chan->shutdown_scriptpubkey[LOCAL]);
db_bind_int(stmt, 34, chan->closer);
db_bind_int(stmt, 35, chan->state_change_cause);
if (chan->shutdown_wrong_funding) {
db_bind_txid(stmt, 35, &chan->shutdown_wrong_funding->txid);
db_bind_int(stmt, 36, chan->shutdown_wrong_funding->n);
db_bind_txid(stmt, 36, &chan->shutdown_wrong_funding->txid);
db_bind_int(stmt, 37, chan->shutdown_wrong_funding->n);
} else {
db_bind_null(stmt, 35);
db_bind_null(stmt, 36);
db_bind_null(stmt, 37);
}
db_bind_u64(stmt, 37, chan->dbid);
db_bind_u64(stmt, 38, chan->dbid);
db_exec_prepared_v2(take(stmt));
wallet_channel_config_save(w, &chan->channel_info.their_config);