channel: remove `psbt` and `remote_tx_sigs`

We just added this, but we've migrated them to the "inflight" struct
instead, as they actually pertain to an single inflight open attempt
This commit is contained in:
niftynei 2021-01-19 18:45:36 -06:00 committed by Rusty Russell
parent e15de71375
commit 4baa10ef68
9 changed files with 244 additions and 284 deletions

View File

@ -205,7 +205,6 @@ 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,
@ -238,7 +237,6 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
const u8 *remote_upfront_shutdown_script,
bool option_static_remotekey,
bool option_anchor_outputs,
struct wally_psbt *psbt STEALS,
enum side closer,
enum state_change reason)
{
@ -282,7 +280,6 @@ 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;
@ -326,12 +323,6 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
channel->option_anchor_outputs = option_anchor_outputs;
channel->forgets = tal_arr(channel, struct command *, 0);
/* If we're already locked in, we no longer need the PSBT */
if (!remote_funding_locked && psbt)
channel->psbt = tal_steal(channel, psbt);
else
channel->psbt = tal_free(psbt);
list_add_tail(&peer->channels, &channel->list);
channel->rr_number = peer->ld->rr_counter++;
tal_add_destructor(channel, destroy_channel);

View File

@ -100,7 +100,6 @@ struct channel {
struct amount_msat push;
bool remote_funding_locked;
bool remote_tx_sigs;
/* Channel if locked locally. */
struct short_channel_id *scid;
@ -180,9 +179,6 @@ struct channel {
/* Our position in the round-robin list. */
u64 rr_number;
/* PSBT, for v2 channels. Saved until it's sent */
struct wally_psbt *psbt;
/* the one that initiated a bilateral close, NUM_SIDES if unknown. */
enum side closer;
@ -213,7 +209,6 @@ 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,
@ -246,7 +241,6 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
const u8 *remote_upfront_shutdown_script STEALS,
bool option_static_remotekey,
bool option_anchor_outputs,
struct wally_psbt *psbt STEALS,
enum side closer,
enum state_change reason);

View File

@ -46,10 +46,7 @@ static void handle_signed_psbt(struct lightningd *ld,
struct commit_rcvd *rcvd)
{
/* Now that we've got the signed PSBT, save it */
rcvd->channel->psbt =
tal_steal(rcvd->channel,
cast_const(struct wally_psbt *, psbt));
wallet_channel_save(ld->wallet, rcvd->channel);
// FIXME: save psbt ?
channel_watch_funding(ld, rcvd->channel);
@ -737,7 +734,6 @@ wallet_commit_channel(struct lightningd *ld,
false, /* !remote_funding_locked */
false, /* !remote_tx_sigs */
NULL, /* no scid yet */
cid,
/* The three arguments below are msatoshi_to_us,
* msatoshi_to_us_min, and msatoshi_to_us_max.
* Because, this is a newly-funded channel,
@ -768,7 +764,6 @@ wallet_commit_channel(struct lightningd *ld,
remote_upfront_shutdown_script,
option_static_remotekey,
option_anchor_outputs,
NULL,
NUM_SIDES, /* closer not yet known */
opener == LOCAL ? REASON_USER : REASON_REMOTE);
@ -1124,8 +1119,7 @@ static void opener_commit_received(struct subd *dualopend,
json_add_hex_talarr(response, "close_to",
uc->fc->our_upfront_shutdown_script);
/* Now that we've got the final PSBT, save it */
channel->psbt = tal_steal(channel, psbt);
wallet_channel_save(uc->fc->cmd->ld->wallet, channel);
// FIXME: update channel->psbt
was_pending(command_success(uc->fc->cmd, response));
@ -1290,6 +1284,8 @@ static void handle_peer_tx_sigs_sent(struct subd *dualopend,
{
struct channel *channel = dualopend->channel;
const struct wally_tx *wtx;
/* FIXME: psbt? */
struct wally_psbt *psbt = NULL;
if (!fromwire_dualopend_tx_sigs_sent(msg)) {
channel_internal_error(channel,
@ -1298,15 +1294,15 @@ static void handle_peer_tx_sigs_sent(struct subd *dualopend,
return;
}
if (psbt_finalize(cast_const(struct wally_psbt *, channel->psbt))) {
wtx = psbt_final_tx(NULL, channel->psbt);
if (psbt_finalize(cast_const(struct wally_psbt *, psbt))) {
wtx = psbt_final_tx(NULL, psbt);
if (!wtx) {
channel_internal_error(channel,
"Unable to extract final tx"
" from PSBT %s",
type_to_string(tmpctx,
struct wally_psbt,
channel->psbt));
psbt));
return;
}
@ -1431,7 +1427,6 @@ void dualopen_tell_depth(struct subd *dualopend,
channel->funding_outnum = inf->funding->outnum;
channel->funding = inf->funding->total_funds;
channel->our_funds = inf->funding->our_funds;
channel->psbt = clone_psbt(channel, inf->funding_psbt);
channel->last_tx = tal_steal(channel, inf->last_tx);
channel->last_sig = inf->last_sig;
@ -1542,6 +1537,7 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend,
const struct wally_tx *wtx;
struct lightningd *ld = dualopend->ld;
struct channel *channel = dualopend->channel;
struct wally_psbt *chan_psbt = NULL;
if (!fromwire_dualopend_funding_sigs(tmpctx, msg, &psbt)) {
channel_internal_error(channel,
@ -1553,31 +1549,31 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend,
/* 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;
// FIXME: inflight->remote_tx_sigs = true;
tal_wally_start();
if (wally_psbt_combine(channel->psbt, psbt) != WALLY_OK) {
if (wally_psbt_combine(chan_psbt, psbt) != WALLY_OK) {
channel_internal_error(channel,
"Unable to combine PSBTs: %s, %s",
type_to_string(tmpctx,
struct wally_psbt,
channel->psbt),
chan_psbt),
type_to_string(tmpctx,
struct wally_psbt,
psbt));
tal_wally_end(channel->psbt);
tal_wally_end(chan_psbt);
return;
}
tal_wally_end(channel->psbt);
tal_wally_end(chan_psbt);
if (psbt_finalize(cast_const(struct wally_psbt *, channel->psbt))) {
wtx = psbt_final_tx(NULL, channel->psbt);
if (psbt_finalize(cast_const(struct wally_psbt *, chan_psbt))) {
wtx = psbt_final_tx(NULL, chan_psbt);
if (!wtx) {
channel_internal_error(channel,
"Unable to extract final tx"
" from PSBT %s",
type_to_string(tmpctx,
struct wally_psbt,
channel->psbt));
chan_psbt));
return;
}
send_funding_tx(channel, take(wtx));
@ -1601,8 +1597,7 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend,
wallet_channel_save(ld->wallet, channel);
/* Send notification with peer's signed PSBT */
notify_openchannel_peer_sigs(ld, &channel->cid,
channel->psbt);
notify_openchannel_peer_sigs(ld, &channel->cid, chan_psbt);
}
static void handle_validate_rbf(struct subd *dualopend,
@ -1726,7 +1721,9 @@ json_openchannel_signed(struct command *cmd,
if (!channel)
return command_fail(cmd, FUNDING_UNKNOWN_CHANNEL,
"Unknown channel");
if (channel->psbt && psbt_is_finalized(channel->psbt))
/* FIXME: use inflight? */
struct wally_psbt *chan_psbt = NULL;
if (chan_psbt && psbt_is_finalized(chan_psbt))
return command_fail(cmd, LIGHTNINGD,
"Already have a finalized PSBT for "
"this channel");
@ -1758,24 +1755,23 @@ json_openchannel_signed(struct command *cmd,
/* Now that we've got the signed PSBT, save it */
tal_wally_start();
if (wally_psbt_combine(cast_const(struct wally_psbt *,
channel->psbt),
if (wally_psbt_combine(cast_const(struct wally_psbt *, chan_psbt),
psbt) != WALLY_OK) {
tal_wally_end(tal_free(channel->psbt));
tal_wally_end(tal_free(psbt));
return command_fail(cmd, FUNDING_PSBT_INVALID,
"Failed adding sigs");
}
/* Make memleak happy, (otherwise cleaned up with `cmd`) */
tal_free(psbt);
tal_wally_end(tal_steal(channel, channel->psbt));
tal_wally_end(tal_steal(channel, chan_psbt));
wallet_channel_save(cmd->ld->wallet, channel);
channel_watch_funding(cmd->ld, channel);
/* Send our tx_sigs to the peer */
subd_send_msg(channel->owner,
take(towire_dualopend_send_tx_sigs(NULL, channel->psbt)));
take(towire_dualopend_send_tx_sigs(NULL, chan_psbt)));
channel->openchannel_signed_cmd = tal_steal(channel, cmd);
return command_still_pending(cmd);
@ -2223,7 +2219,7 @@ void peer_restart_dualopend(struct peer *peer,
channel->our_msat,
&channel->channel_info.theirbase,
&channel->channel_info.remote_per_commit,
channel->psbt,
NULL, /* FIXME! */
channel->opener,
channel->scid != NULL,
channel->remote_funding_locked,
@ -2231,7 +2227,7 @@ void peer_restart_dualopend(struct peer *peer,
channel->shutdown_scriptpubkey[REMOTE] != NULL,
channel->shutdown_scriptpubkey[LOCAL],
channel->remote_upfront_shutdown_script,
channel->remote_tx_sigs,
false, /* FIXME! */
channel->fee_states,
channel->channel_flags,
send_msg);

View File

@ -176,7 +176,6 @@ 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,
@ -210,7 +209,6 @@ wallet_commit_channel(struct lightningd *ld,
remote_upfront_shutdown_script,
option_static_remotekey,
option_anchor_outputs,
NULL,
NUM_SIDES, /* closer not yet known */
uc->fc ? REASON_USER : REASON_REMOTE);

View File

@ -1233,8 +1233,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, 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;",
.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 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 FROM channels WHERE state != $1;",
.placeholders = 1,
.readonly = true,
},
@ -1299,9 +1299,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=?, 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,
.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=? 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 WHERE id=$36",
.placeholders = 36,
.readonly = false,
},
{
@ -1834,4 +1834,4 @@ struct db_query db_postgres_queries[] = {
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
// SHA256STAMP:044504d8dccba17231afc233809d113884b6e73ef6a3b414d061df94982755a5
// SHA256STAMP:bd2601eacac93b31e97a7bacfd71545dc748a47e40babb05e7e8dd77b009417d

View File

@ -1233,8 +1233,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, 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 != ?;",
.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 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 FROM channels WHERE state != ?;",
.placeholders = 1,
.readonly = true,
},
@ -1299,9 +1299,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=?, 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,
.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=? 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=? WHERE id=?",
.placeholders = 36,
.readonly = false,
},
{
@ -1834,4 +1834,4 @@ struct db_query db_sqlite3_queries[] = {
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
// SHA256STAMP:044504d8dccba17231afc233809d113884b6e73ef6a3b414d061df94982755a5
// SHA256STAMP:bd2601eacac93b31e97a7bacfd71545dc748a47e40babb05e7e8dd77b009417d

View File

@ -810,387 +810,387 @@ msgstr ""
msgid "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig FROM channel_funding_inflights WHERE channel_id = ?"
msgstr ""
#: wallet/wallet.c:1256
#: wallet/wallet.c:1248
msgid "SELECT id FROM channels ORDER BY id DESC LIMIT 1;"
msgstr ""
#: wallet/wallet.c:1273
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 != ?;"
#: wallet/wallet.c:1265
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 FROM channels WHERE state != ?;"
msgstr ""
#: wallet/wallet.c:1366
#: wallet/wallet.c:1356
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:1371
#: wallet/wallet.c:1361
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:1376
#: wallet/wallet.c:1366
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:1381
#: wallet/wallet.c:1371
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:1423
#: wallet/wallet.c:1413
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:1452
#: wallet/wallet.c:1442
msgid "SELECT MIN(height), MAX(height) FROM blocks;"
msgstr ""
#: wallet/wallet.c:1474
#: wallet/wallet.c:1464
msgid "INSERT INTO channel_configs DEFAULT VALUES;"
msgstr ""
#: wallet/wallet.c:1486
#: wallet/wallet.c:1476
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:1510
#: wallet/wallet.c:1500
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:1544
#: wallet/wallet.c:1534
msgid "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1563
msgid "UPDATE channels SET shachain_remote_id=?, short_channel_id=?, full_channel_id=?, state=?, funder=?, channel_flags=?, minimum_depth=?, next_index_local=?, next_index_remote=?, next_htlc_id=?, funding_tx_id=?, funding_tx_outnum=?, funding_satoshi=?, our_funding_satoshi=?, funding_locked_remote=?, 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=?"
#: wallet/wallet.c:1553
msgid "UPDATE channels SET shachain_remote_id=?, short_channel_id=?, full_channel_id=?, state=?, funder=?, channel_flags=?, minimum_depth=?, next_index_local=?, next_index_remote=?, next_htlc_id=?, funding_tx_id=?, funding_tx_outnum=?, funding_satoshi=?, our_funding_satoshi=?, funding_locked_remote=?, push_msatoshi=?, msatoshi_local=?, shutdown_scriptpubkey_remote=?, shutdown_keyidx_local=?, channel_config_local=?, last_tx=?, last_sig=?, last_was_revoke=?, min_possible_feerate=?, max_possible_feerate=?, msatoshi_to_us_min=?, msatoshi_to_us_max=?, feerate_base=?, feerate_ppm=?, remote_upfront_shutdown_script=?, option_static_remotekey=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1653
#: wallet/wallet.c:1636
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:1680
#: wallet/wallet.c:1663
msgid "DELETE FROM channel_feerates WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1690
#: wallet/wallet.c:1673
msgid "INSERT INTO channel_feerates VALUES(?, ?, ?)"
msgstr ""
#: wallet/wallet.c:1707
#: wallet/wallet.c:1690
msgid "UPDATE channels SET last_sent_commit=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1730
#: wallet/wallet.c:1713
msgid "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:1758
#: wallet/wallet.c:1741
msgid "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;"
msgstr ""
#: wallet/wallet.c:1787
#: wallet/wallet.c:1770
msgid "SELECT id FROM peers WHERE node_id = ?"
msgstr ""
#: wallet/wallet.c:1799
#: wallet/wallet.c:1782
msgid "UPDATE peers SET address = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:1808
#: wallet/wallet.c:1791
msgid "INSERT INTO peers (node_id, address) VALUES (?, ?);"
msgstr ""
#: wallet/wallet.c:1826
#: wallet/wallet.c:1809
msgid "INSERT INTO channels (peer_id, first_blocknum, id) VALUES (?, ?, ?);"
msgstr ""
#: wallet/wallet.c:1852
#: wallet/wallet.c:1835
msgid "DELETE FROM channel_htlcs WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1858
#: wallet/wallet.c:1841
msgid "DELETE FROM htlc_sigs WHERE channelid=?"
msgstr ""
#: wallet/wallet.c:1864
#: wallet/wallet.c:1847
msgid "DELETE FROM channeltxs WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1871
#: wallet/wallet.c:1854
msgid "DELETE FROM channel_funding_inflights WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1877
#: wallet/wallet.c:1860
msgid "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)"
msgstr ""
#: wallet/wallet.c:1887
#: wallet/wallet.c:1870
msgid "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?"
msgstr ""
#: wallet/wallet.c:1901
#: wallet/wallet.c:1884
msgid "SELECT * FROM channels WHERE peer_id = ?;"
msgstr ""
#: wallet/wallet.c:1909
#: wallet/wallet.c:1892
msgid "DELETE FROM peers WHERE id=?"
msgstr ""
#: wallet/wallet.c:1920
#: wallet/wallet.c:1903
msgid "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?"
msgstr ""
#: wallet/wallet.c:2023
#: wallet/wallet.c:2006
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:2076
#: wallet/wallet.c:2059
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:2137
#: wallet/wallet.c:2120
msgid "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:2353
#: wallet/wallet.c:2336
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:2400
#: wallet/wallet.c:2383
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:2531
#: wallet/wallet.c:2514
msgid "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;"
msgstr ""
#: wallet/wallet.c:2565
#: wallet/wallet.c:2548
msgid "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2618
#: wallet/wallet.c:2601
msgid "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2636
#: wallet/wallet.c:2619
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:2725
#: wallet/wallet.c:2708
msgid "DELETE FROM payments WHERE payment_hash = ? AND partid = ?"
msgstr ""
#: wallet/wallet.c:2739
#: wallet/wallet.c:2722
msgid "DELETE FROM payments WHERE payment_hash = ?"
msgstr ""
#: wallet/wallet.c:2840
#: wallet/wallet.c:2823
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:2890
#: wallet/wallet.c:2873
msgid "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?"
msgstr ""
#: wallet/wallet.c:2900
#: wallet/wallet.c:2883
msgid "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?"
msgstr ""
#: wallet/wallet.c:2910
#: wallet/wallet.c:2893
msgid "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2942
#: wallet/wallet.c:2925
msgid "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;"
msgstr ""
#: wallet/wallet.c:3009
#: wallet/wallet.c:2992
msgid "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;"
msgstr ""
#: wallet/wallet.c:3068
#: wallet/wallet.c:3051
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:3090
#: wallet/wallet.c:3073
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:3141
#: wallet/wallet.c:3124
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:3186
#: wallet/wallet.c:3169
msgid "DELETE FROM htlc_sigs WHERE channelid = ?"
msgstr ""
#: wallet/wallet.c:3193
#: wallet/wallet.c:3176
msgid "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)"
msgstr ""
#: wallet/wallet.c:3205
#: wallet/wallet.c:3188
msgid "SELECT blobval FROM vars WHERE name='genesis_hash'"
msgstr ""
#: wallet/wallet.c:3229
#: wallet/wallet.c:3212
msgid "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);"
msgstr ""
#: wallet/wallet.c:3247
#: wallet/wallet.c:3230
msgid "SELECT txid, outnum FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3259
#: wallet/wallet.c:3242
msgid "DELETE FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3267 wallet/wallet.c:3381
#: wallet/wallet.c:3250 wallet/wallet.c:3364
msgid "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3286
#: wallet/wallet.c:3269
msgid "DELETE FROM blocks WHERE hash = ?"
msgstr ""
#: wallet/wallet.c:3292
#: wallet/wallet.c:3275
msgid "SELECT * FROM blocks WHERE height >= ?;"
msgstr ""
#: wallet/wallet.c:3301
#: wallet/wallet.c:3284
msgid "DELETE FROM blocks WHERE height > ?"
msgstr ""
#: wallet/wallet.c:3313
#: wallet/wallet.c:3296
msgid "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?"
msgstr ""
#: wallet/wallet.c:3331
#: wallet/wallet.c:3314
msgid "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?"
msgstr ""
#: wallet/wallet.c:3354 wallet/wallet.c:3392
#: wallet/wallet.c:3337 wallet/wallet.c:3375
msgid "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3418
#: wallet/wallet.c:3401
msgid "SELECT height FROM blocks WHERE height = ?"
msgstr ""
#: wallet/wallet.c:3431
#: wallet/wallet.c:3414
msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL"
msgstr ""
#: wallet/wallet.c:3473
#: wallet/wallet.c:3456
msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?"
msgstr ""
#: wallet/wallet.c:3504 wallet/wallet.c:3664
#: wallet/wallet.c:3487 wallet/wallet.c:3647
msgid "SELECT blockheight FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3514
#: wallet/wallet.c:3497
msgid "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3535
#: wallet/wallet.c:3518
msgid "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3552
#: wallet/wallet.c:3535
msgid "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;"
msgstr ""
#: wallet/wallet.c:3584
#: wallet/wallet.c:3567
msgid "SELECT type, channel_id FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3600
#: wallet/wallet.c:3583
msgid "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3619
#: wallet/wallet.c:3602
msgid "SELECT type FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3642
#: wallet/wallet.c:3625
msgid "SELECT rawtx FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3688
#: wallet/wallet.c:3671
msgid "SELECT blockheight, txindex FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3716
#: wallet/wallet.c:3699
msgid "SELECT id FROM transactions WHERE blockheight=?"
msgstr ""
#: wallet/wallet.c:3735
#: wallet/wallet.c:3718
msgid "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3759
#: wallet/wallet.c:3742
msgid "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;"
msgstr ""
#: wallet/wallet.c:3780
#: wallet/wallet.c:3763
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:3825
#: wallet/wallet.c:3808
msgid "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?"
msgstr ""
#: wallet/wallet.c:3883
#: wallet/wallet.c:3866
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:3942
#: wallet/wallet.c:3925
msgid "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;"
msgstr ""
#: wallet/wallet.c:3991
#: wallet/wallet.c:3974
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:4113
#: wallet/wallet.c:4096
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:4207
#: wallet/wallet.c:4190
msgid "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4232
#: wallet/wallet.c:4215
msgid "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?"
msgstr ""
#: wallet/wallet.c:4256
#: wallet/wallet.c:4239
msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?"
msgstr ""
#: wallet/wallet.c:4274
#: wallet/wallet.c:4257
msgid "SELECT 1 FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4287
#: wallet/wallet.c:4270
msgid "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4314
#: wallet/wallet.c:4297
msgid "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4342
#: wallet/wallet.c:4325
msgid "SELECT offer_id FROM offers;"
msgstr ""
#: wallet/wallet.c:4368
#: wallet/wallet.c:4351
msgid "UPDATE offers SET status=? WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4379
#: wallet/wallet.c:4362
msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4407
#: wallet/wallet.c:4390
msgid "SELECT status FROM offers WHERE offer_id = ?;"
msgstr ""
@ -1206,7 +1206,7 @@ msgstr ""
msgid "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = ?;"
msgstr ""
#: wallet/test/run-wallet.c:1599
#: wallet/test/run-wallet.c:1597
msgid "INSERT INTO channels (id) VALUES (1);"
msgstr ""
# SHA256STAMP:c2d1cde87b8704ec22eefc11c71500fc0e69897f36404be9ac2cc0b5d8312279
# SHA256STAMP:8eabbc819a99d6803565907ab1e4e9988a3aa2212149235cb43ffc2319ac903a

View File

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

View File

@ -1084,7 +1084,6 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm
struct pubkey *future_per_commitment_point;
struct amount_sat funding_sat, our_funding_sat;
struct amount_msat push_msat, our_msat, msat_to_us_min, msat_to_us_max;
struct wally_psbt *psbt;
peer_dbid = db_column_u64(stmt, 1);
peer = find_peer_by_dbid(w->ld, peer_dbid);
@ -1103,15 +1102,15 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm
scid = NULL;
}
ok &= wallet_shachain_load(w, db_column_u64(stmt, 30), &wshachain);
ok &= wallet_shachain_load(w, db_column_u64(stmt, 29), &wshachain);
remote_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 31, u8);
local_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 50, u8);
remote_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 30, u8);
local_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 49, u8);
/* Do we have a last_sent_commit, if yes, populate */
if (!db_column_is_null(stmt, 44)) {
const u8 *cursor = db_column_blob(stmt, 44);
size_t len = db_column_bytes(stmt, 44);
if (!db_column_is_null(stmt, 43)) {
const u8 *cursor = db_column_blob(stmt, 43);
size_t len = db_column_bytes(stmt, 43);
size_t n = 0;
last_sent_commit = tal_arr(tmpctx, struct changed_htlc, n);
while (len) {
@ -1123,16 +1122,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, 33)) {
if (!last_sent_commit && !db_column_is_null(stmt, 32)) {
last_sent_commit = tal(tmpctx, struct changed_htlc);
last_sent_commit->newstate = db_column_u64(stmt, 33);
last_sent_commit->id = db_column_u64(stmt, 34);
last_sent_commit->newstate = db_column_u64(stmt, 32);
last_sent_commit->id = db_column_u64(stmt, 33);
}
#endif
if (!db_column_is_null(stmt, 43)) {
if (!db_column_is_null(stmt, 42)) {
future_per_commitment_point = tal(tmpctx, struct pubkey);
db_column_pubkey(stmt, 43, future_per_commitment_point);
db_column_pubkey(stmt, 42, future_per_commitment_point);
} else
future_per_commitment_point = NULL;
@ -1140,17 +1139,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, 36, &last_sig.s);
ok &= db_column_signature(stmt, 35, &last_sig.s);
last_sig.sighash_type = SIGHASH_ALL;
/* Populate channel_info */
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);
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);
wallet_channel_config_load(w, db_column_u64(stmt, 5),
&channel_info.their_config);
@ -1167,7 +1166,7 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm
return NULL;
}
final_key_idx = db_column_u64(stmt, 32);
final_key_idx = db_column_u64(stmt, 31);
if (final_key_idx < 0) {
tal_free(fee_states);
log_broken(w->log, "%s: Final key < 0", __func__);
@ -1179,15 +1178,10 @@ 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, 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, 51)) {
psbt = db_column_psbt(tmpctx, stmt, 51);
} else
psbt = NULL;
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);
chan = new_channel(peer, db_column_u64(stmt, 0),
&wshachain,
@ -1207,39 +1201,37 @@ 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, 35),
db_column_psbt_to_tx(tmpctx, stmt, 34),
&last_sig,
wallet_htlc_sigs_load(tmpctx, w,
db_column_u64(stmt, 0),
db_column_int(stmt, 49)),
db_column_int(stmt, 48)),
&channel_info,
take(fee_states),
remote_shutdown_scriptpubkey,
local_shutdown_scriptpubkey,
final_key_idx,
db_column_int(stmt, 37) != 0,
db_column_int(stmt, 36) != 0,
last_sent_commit,
db_column_u64(stmt, 38),
db_column_u64(stmt, 37),
db_column_int(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_int(stmt, 46),
db_column_arr(tmpctx, stmt, 47, u8),
db_column_arr(tmpctx, stmt, 46, u8),
db_column_int(stmt, 47),
db_column_int(stmt, 48),
db_column_int(stmt, 49),
psbt,
db_column_int(stmt, 52),
db_column_int(stmt, 53));
db_column_int(stmt, 50),
db_column_int(stmt, 51));
if (!wallet_channel_load_inflights(w, chan)) {
tal_free(chan);
@ -1289,42 +1281,40 @@ static bool wallet_channels_load_active(struct wallet *w)
", 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
", push_msatoshi" // 18
", msatoshi_local" // 19
", fundingkey_remote" // 20
", revocation_basepoint_remote" // 21
", payment_basepoint_remote" // 22
", htlc_basepoint_remote" // 23
", delayed_payment_basepoint_remote"
", 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
", per_commit_remote" // 25
", old_per_commit_remote" // 26
", local_feerate_per_kw" // 27
", remote_feerate_per_kw" // 28
", shachain_remote_id" // 29
", shutdown_scriptpubkey_remote" // 30
", shutdown_keyidx_local" // 31
", last_sent_commit_state" // 32
", last_sent_commit_id" // 33
", last_tx" // 34
", last_sig" // 35
", last_was_revoke" // 36
", first_blocknum" // 37
", min_possible_feerate" // 38
", max_possible_feerate" // 39
", msatoshi_to_us_min" // 40
", msatoshi_to_us_max" // 41
", future_per_commitment_point" // 42
", last_sent_commit" // 43
", 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
" FROM channels"
" WHERE state != ?;")); //? 0
db_bind_int(stmt, 0, CLOSED);
@ -1576,28 +1566,26 @@ void wallet_channel_save(struct wallet *w, struct channel *chan)
" funding_satoshi=?," // 12
" our_funding_satoshi=?," // 13
" funding_locked_remote=?," // 14
" funding_tx_remote_sigs_received=?," // 15
" push_msatoshi=?," // 16
" msatoshi_local=?," // 17
" push_msatoshi=?," // 15
" msatoshi_local=?," // 16
" shutdown_scriptpubkey_remote=?,"
" 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
" shutdown_keyidx_local=?," // 18
" channel_config_local=?," // 19
" last_tx=?, last_sig=?," // 20 + 21
" last_was_revoke=?," // 22
" min_possible_feerate=?," // 23
" max_possible_feerate=?," // 24
" msatoshi_to_us_min=?," // 25
" msatoshi_to_us_max=?," // 26
" feerate_base=?," // 27
" feerate_ppm=?," // 28
" remote_upfront_shutdown_script=?,"
" option_static_remotekey=?," // 31
" option_anchor_outputs=?," // 32
" shutdown_scriptpubkey_local=?," // 33
" funding_psbt=?," // 34
" closer=?," // 35
" state_change_reason=?" // 36
" WHERE id=?")); // 37
" option_static_remotekey=?," // 30
" option_anchor_outputs=?," // 31
" shutdown_scriptpubkey_local=?," // 32
" closer=?," // 33
" state_change_reason=?" // 34
" WHERE id=?")); // 35
db_bind_u64(stmt, 0, chan->their_shachain.id);
if (chan->scid)
db_bind_short_channel_id(stmt, 1, chan->scid);
@ -1620,33 +1608,28 @@ 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_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_amount_msat(stmt, 15, &chan->push);
db_bind_amount_msat(stmt, 16, &chan->our_msat);
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, 34, chan->psbt);
else
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_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_int(stmt, 33, chan->closer);
db_bind_int(stmt, 34, chan->state_change_cause);
db_bind_u64(stmt, 35, chan->dbid);
db_exec_prepared_v2(take(stmt));
wallet_channel_config_save(w, &chan->channel_info.their_config);