lease_rates: persist channel's lease info

This commit is contained in:
niftynei 2021-06-16 20:28:18 -05:00 committed by neil saitug
parent 5041073a55
commit a396c341cf
16 changed files with 613 additions and 196 deletions

View File

@ -11,6 +11,7 @@
#include <common/initial_channel.h>
#include <common/initial_commit_tx.h>
#include <common/keyset.h>
#include <common/lease_rates.h>
#include <common/type_to_string.h>
#include <inttypes.h>
#include <wire/peer_wire.h>
@ -89,6 +90,7 @@ struct bitcoin_tx *initial_channel_tx(const tal_t *ctx,
{
struct keyset keyset;
struct bitcoin_tx *init_tx;
u32 csv_lock;
/* This assumes no HTLCs! */
assert(!channel->htlcs);
@ -102,6 +104,13 @@ struct bitcoin_tx *initial_channel_tx(const tal_t *ctx,
return NULL;
}
/* Figure out the csv_lock (if there's a lease) */
if (channel->lease_expiry == 0)
csv_lock = 1;
else
/* FIXME: */
csv_lock = 1;
*wscript = bitcoin_redeem_2of2(ctx,
&channel->funding_pubkey[side],
&channel->funding_pubkey[!side]);
@ -121,9 +130,7 @@ struct bitcoin_tx *initial_channel_tx(const tal_t *ctx,
channel->config[!side].channel_reserve,
0 ^ channel->commitment_number_obscurer,
direct_outputs,
side,
/* FIXME: is not the csv lock ?! */
channel->lease_expiry,
side, csv_lock,
channel->option_anchor_outputs,
err_reason);

View File

@ -160,7 +160,11 @@ new_inflight(struct channel *channel,
struct amount_sat our_funds,
struct wally_psbt *psbt STEALS,
struct bitcoin_tx *last_tx,
const struct bitcoin_signature last_sig)
const struct bitcoin_signature last_sig,
const u32 lease_expiry,
const secp256k1_ecdsa_signature *lease_commit_sig,
const u32 lease_chan_max_msat,
const u16 lease_chan_max_ppt)
{
struct wally_psbt *last_tx_psbt_clone;
struct channel_inflight *inflight
@ -185,6 +189,11 @@ new_inflight(struct channel *channel,
inflight->last_sig = last_sig;
inflight->tx_broadcast = false;
inflight->lease_expiry = lease_expiry;
inflight->lease_commit_sig = tal_dup(inflight, secp256k1_ecdsa_signature, lease_commit_sig);
inflight->lease_chan_max_msat = lease_chan_max_msat;
inflight->lease_chan_max_ppt = lease_chan_max_ppt;
list_add_tail(&channel->inflights, &inflight->list);
tal_add_destructor(inflight, destroy_inflight);
@ -268,6 +277,8 @@ struct channel *new_unsaved_channel(struct peer *peer,
channel->option_anchor_outputs = true;
channel->future_per_commitment_point = NULL;
channel->lease_commit_sig = NULL;
/* No shachain yet */
channel->their_shachain.id = 0;
shachain_init(&channel->their_shachain.chain);
@ -341,7 +352,11 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
enum side closer,
enum state_change reason,
/* NULL or stolen */
const struct bitcoin_outpoint *shutdown_wrong_funding)
const struct bitcoin_outpoint *shutdown_wrong_funding,
u32 lease_expiry,
secp256k1_ecdsa_signature *lease_commit_sig STEALS,
u32 lease_chan_max_msat,
u16 lease_chan_max_ppt)
{
struct channel *channel = tal(peer->ld, struct channel);
@ -430,6 +445,11 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
channel->option_anchor_outputs = option_anchor_outputs;
channel->forgets = tal_arr(channel, struct command *, 0);
channel->lease_expiry = lease_expiry;
channel->lease_commit_sig = tal_steal(channel, lease_commit_sig);
channel->lease_chan_max_msat = lease_chan_max_msat;
channel->lease_chan_max_ppt = lease_chan_max_ppt;
list_add_tail(&peer->channels, &channel->list);
channel->rr_number = peer->ld->rr_counter++;
tal_add_destructor(channel, destroy_channel);

View File

@ -45,6 +45,12 @@ struct channel_inflight {
/* Commitment tx and sigs */
struct bitcoin_tx *last_tx;
struct bitcoin_signature last_sig;
/* Channel lease infos */
u32 lease_expiry;
secp256k1_ecdsa_signature *lease_commit_sig;
u32 lease_chan_max_msat;
u16 lease_chan_max_ppt;
};
struct open_attempt {
@ -208,6 +214,18 @@ struct channel {
/* Outstanding command for this channel, v2 only */
struct command *openchannel_signed_cmd;
/* Block lease expires at, zero is no lease */
u32 lease_expiry;
/* Lease commitment, useful someone breaks their promise
* wrt channel fees */
secp256k1_ecdsa_signature *lease_commit_sig;
/* Lease commited maximum channel fee base msat */
u32 lease_chan_max_msat;
/* Lease commited max part per thousandth channel fee (ppm * 1000) */
u16 lease_chan_max_ppt;
};
/* For v2 opens, a channel that has not yet been committed/saved to disk */
@ -273,7 +291,11 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
enum side closer,
enum state_change reason,
/* NULL or stolen */
const struct bitcoin_outpoint *shutdown_wrong_funding STEALS);
const struct bitcoin_outpoint *shutdown_wrong_funding STEALS,
u32 lease_expiry,
secp256k1_ecdsa_signature *lease_commit_sig STEALS,
u32 lease_chan_max_msat,
u16 lease_chan_max_ppt);
/* new_inflight - Create a new channel_inflight for a channel */
struct channel_inflight *
@ -285,7 +307,11 @@ new_inflight(struct channel *channel,
struct amount_sat our_funds,
struct wally_psbt *funding_psbt STEALS,
struct bitcoin_tx *last_tx STEALS,
const struct bitcoin_signature last_sig);
const struct bitcoin_signature last_sig,
const u32 lease_expiry,
const secp256k1_ecdsa_signature *lease_commit_sig,
const u32 lease_chan_max_msat,
const u16 lease_chan_max_ppt);
/* Given a txid, find an inflight channel stub. Returns NULL if none found */
struct channel_inflight *channel_inflight_find(struct channel *channel,

View File

@ -1112,7 +1112,11 @@ wallet_update_channel(struct lightningd *ld,
struct amount_sat total_funding,
struct amount_sat our_funding,
u32 funding_feerate,
struct wally_psbt *psbt STEALS)
struct wally_psbt *psbt STEALS,
const u32 lease_expiry,
secp256k1_ecdsa_signature *lease_commit_sig STEALS,
const u32 lease_chan_max_msat,
const u16 lease_chan_max_ppt)
{
struct amount_msat our_msat;
struct channel_inflight *inflight;
@ -1132,6 +1136,12 @@ wallet_update_channel(struct lightningd *ld,
channel->our_msat = our_msat;
channel->msat_to_us_min = our_msat;
channel->msat_to_us_max = our_msat;
channel->lease_expiry = lease_expiry;
tal_free(channel->lease_commit_sig);
channel->lease_commit_sig = tal_steal(channel, lease_commit_sig);
channel->lease_chan_max_msat = lease_chan_max_msat;
channel->lease_chan_max_ppt = lease_chan_max_ppt;
channel_set_last_tx(channel,
tal_steal(channel, remote_commit),
@ -1150,7 +1160,11 @@ wallet_update_channel(struct lightningd *ld,
channel->our_funds,
psbt,
channel->last_tx,
channel->last_sig);
channel->last_sig,
channel->lease_expiry,
channel->lease_commit_sig,
channel->lease_chan_max_msat,
channel->lease_chan_max_ppt);
wallet_inflight_add(ld->wallet, inflight);
return inflight;
@ -1171,7 +1185,11 @@ wallet_commit_channel(struct lightningd *ld,
u32 commitment_feerate,
const u8 *our_upfront_shutdown_script,
const u8 *remote_upfront_shutdown_script,
struct wally_psbt *psbt STEALS)
struct wally_psbt *psbt STEALS,
const u32 lease_expiry,
secp256k1_ecdsa_signature *lease_commit_sig STEALS,
const u32 lease_chan_max_msat,
const u16 lease_chan_max_ppt)
{
struct amount_msat our_msat;
struct channel_inflight *inflight;
@ -1238,6 +1256,15 @@ wallet_commit_channel(struct lightningd *ld,
* in theory, but it's only used for timing out. */
channel->first_blocknum = get_block_height(ld->topology);
/* Update lease info for channel */
channel->lease_expiry = lease_expiry;
tal_free(channel->lease_commit_sig);
channel->lease_commit_sig = tal_steal(channel, lease_commit_sig);
channel->lease_chan_max_msat = lease_chan_max_msat;
channel->lease_chan_max_ppt = lease_chan_max_ppt;
/* Now we finally put it in the database. */
wallet_channel_insert(ld->wallet, channel);
@ -1250,7 +1277,11 @@ wallet_commit_channel(struct lightningd *ld,
channel->our_funds,
psbt,
channel->last_tx,
channel->last_sig);
channel->last_sig,
channel->lease_expiry,
channel->lease_commit_sig,
channel->lease_chan_max_msat,
channel->lease_chan_max_ppt);
wallet_inflight_add(ld->wallet, inflight);
return inflight;
@ -2804,8 +2835,9 @@ static void handle_commit_received(struct subd *dualopend,
struct bitcoin_tx *remote_commit;
struct bitcoin_signature remote_commit_sig;
struct bitcoin_txid funding_txid;
u16 funding_outnum;
u32 feerate_funding, feerate_commitment;
u16 funding_outnum, lease_chan_max_ppt;
u32 feerate_funding, feerate_commitment, lease_expiry,
lease_chan_max_msat;
struct amount_sat total_funding, funding_ours;
u8 *remote_upfront_shutdown_script,
*local_upfront_shutdown_script;
@ -2815,6 +2847,7 @@ static void handle_commit_received(struct subd *dualopend,
struct openchannel2_psbt_payload *payload;
struct channel_inflight *inflight;
struct command *cmd = oa->cmd;
secp256k1_ecdsa_signature *lease_commit_sig;
if (!fromwire_dualopend_commit_rcvd(tmpctx, msg,
&channel_info.their_config,
@ -2836,7 +2869,11 @@ static void handle_commit_received(struct subd *dualopend,
&feerate_funding,
&feerate_commitment,
&local_upfront_shutdown_script,
&remote_upfront_shutdown_script)) {
&remote_upfront_shutdown_script,
&lease_expiry,
&lease_commit_sig,
&lease_chan_max_msat,
&lease_chan_max_ppt)) {
channel_internal_error(channel,
"Bad WIRE_DUALOPEND_COMMIT_RCVD: %s",
tal_hex(msg, msg));
@ -2877,7 +2914,11 @@ static void handle_commit_received(struct subd *dualopend,
oa->our_upfront_shutdown_script :
local_upfront_shutdown_script,
remote_upfront_shutdown_script,
psbt))) {
psbt,
lease_expiry,
lease_commit_sig,
lease_chan_max_msat,
lease_chan_max_ppt))) {
channel_internal_error(channel,
"wallet_commit_channel failed"
" (chan %s)",
@ -2906,7 +2947,11 @@ static void handle_commit_received(struct subd *dualopend,
total_funding,
funding_ours,
feerate_funding,
psbt))) {
psbt,
lease_expiry,
lease_commit_sig,
lease_chan_max_msat,
lease_chan_max_ppt))) {
channel_internal_error(channel,
"wallet_update_channel failed"
" (chan %s)",
@ -3255,7 +3300,11 @@ void peer_restart_dualopend(struct peer *peer,
channel->remote_upfront_shutdown_script,
inflight->remote_tx_sigs,
channel->fee_states,
channel->channel_flags);
channel->channel_flags,
inflight->lease_expiry,
inflight->lease_commit_sig,
inflight->lease_chan_max_msat,
inflight->lease_chan_max_ppt);
subd_send_msg(channel->owner, take(msg));

View File

@ -216,7 +216,8 @@ wallet_commit_channel(struct lightningd *ld,
option_anchor_outputs,
NUM_SIDES, /* closer not yet known */
uc->fc ? REASON_USER : REASON_REMOTE,
NULL);
NULL,
0, NULL, 0, 0); /* No leases on v1s */
/* Now we finally put it in the database. */
wallet_channel_insert(ld->wallet, channel);

View File

@ -1344,6 +1344,14 @@ static void update_channel_from_inflight(struct lightningd *ld,
channel->funding = inflight->funding->total_funds;
channel->our_funds = inflight->funding->our_funds;
/* Lease infos ! */
channel->lease_expiry = inflight->lease_expiry;
tal_free(channel->lease_commit_sig);
channel->lease_commit_sig
= tal_steal(channel, inflight->lease_commit_sig);
channel->lease_chan_max_msat = inflight->lease_chan_max_msat;
channel->lease_chan_max_ppt = inflight->lease_chan_max_ppt;
/* Make a 'clone' of this tx */
psbt_copy = clone_psbt(channel, inflight->last_tx->psbt);
channel_set_last_tx(channel,

View File

@ -126,6 +126,15 @@ struct tx_state {
/* If delay til the channel funds lease expires */
u32 lease_expiry;
/* Lease's commit sig */
secp256k1_ecdsa_signature *lease_commit_sig;
/* Lease's commited chan max msat */
u32 lease_chan_max_msat;
/* Lease's commited chan max ppt */
u16 lease_chan_max_ppt;
};
static struct tx_state *new_tx_state(const tal_t *ctx)
@ -134,6 +143,11 @@ static struct tx_state *new_tx_state(const tal_t *ctx)
tx_state->psbt = NULL;
tx_state->remote_funding_sigs_rcvd = false;
tx_state->lease_expiry = 0;
tx_state->lease_commit_sig = NULL;
tx_state->lease_chan_max_msat = 0;
tx_state->lease_chan_max_ppt = 0;
for (size_t i = 0; i < NUM_TX_MSGS; i++)
tx_state->tx_msg_count[i] = 0;
@ -560,6 +574,7 @@ static char *check_balances(const tal_t *ctx,
struct state *state,
struct tx_state *tx_state,
struct wally_psbt *psbt,
struct amount_sat lease_fee,
u32 feerate_per_kw_funding)
{
struct amount_sat initiator_inputs, initiator_outs,
@ -706,8 +721,18 @@ static char *check_balances(const tal_t *ctx,
}
}
tot_output_amt = AMOUNT_SAT(0);
initiator_outs = tx_state->opener_funding;
accepter_outs = tx_state->accepter_funding;
/* The lease_fee has been added to the accepter_funding,
* but the opener_funding is responsible for covering it,
* so we do a little switcheroo here */
if (!amount_sat_add(&initiator_outs, initiator_outs, lease_fee))
return "overflow adding lease_fee to initiator's funding";
if (!amount_sat_sub(&accepter_outs, accepter_outs, lease_fee))
return "unable to subtract lease_fee from accepter's funding";
for (size_t i = 0; i < psbt->num_outputs; i++) {
struct amount_sat amt =
psbt_output_get_amount(psbt, i);
@ -1693,6 +1718,7 @@ static void revert_channel_state(struct state *state)
static u8 *accepter_commits(struct state *state,
struct tx_state *tx_state,
struct amount_sat total,
struct amount_sat lease_fee,
char **err_reason)
{
struct wally_tx_output *direct_outputs[NUM_SIDES];
@ -1727,6 +1753,7 @@ static u8 *accepter_commits(struct state *state,
/* Check tx funds are sane */
error = check_balances(tmpctx, state, tx_state,
tx_state->psbt,
lease_fee,
tx_state->feerate_per_kw_funding);
if (error) {
*err_reason = tal_fmt(tmpctx, "Insufficiently funded"
@ -1894,7 +1921,11 @@ static u8 *accepter_commits(struct state *state,
tx_state->feerate_per_kw_funding,
state->feerate_per_kw_commitment,
state->upfront_shutdown_script[LOCAL],
state->upfront_shutdown_script[REMOTE]);
state->upfront_shutdown_script[REMOTE],
tx_state->lease_expiry,
tx_state->lease_commit_sig,
tx_state->lease_chan_max_msat,
tx_state->lease_chan_max_ppt);
wire_sync_write(REQ_FD, take(msg));
msg = wire_sync_read(tmpctx, REQ_FD);
@ -1911,17 +1942,19 @@ static u8 *accepter_commits(struct state *state,
}
static void accept_tlv_add_offer(struct tlv_accept_tlvs *a_tlv,
struct tx_state *tx_state,
struct lease_rates *rates,
struct pubkey funding_pubkey,
u32 blockheight)
{
secp256k1_ecdsa_signature ad_sig;
u8 *msg;
u32 lease_expiry = blockheight + LEASE_RATE_DURATION;
tx_state->lease_commit_sig = tal(tx_state, secp256k1_ecdsa_signature);
/* Go get the signature for this lease offer from HSMD */
msg = towire_hsmd_sign_option_will_fund_offer(NULL,
&funding_pubkey,
blockheight,
lease_expiry,
rates->channel_fee_max_base_msat,
rates->channel_fee_max_proportional_thousandths);
if (!wire_sync_write(HSM_FD, take(msg)))
@ -1929,7 +1962,8 @@ static void accept_tlv_add_offer(struct tlv_accept_tlvs *a_tlv,
"Could not write to HSM: %s",
strerror(errno));
msg = wire_sync_read(tmpctx, HSM_FD);
if (!fromwire_hsmd_sign_option_will_fund_offer_reply(msg, &ad_sig))
if (!fromwire_hsmd_sign_option_will_fund_offer_reply(msg,
tx_state->lease_commit_sig))
status_failed(STATUS_FAIL_HSM_IO,
"Bad sign_option_will_fund_offer_reply %s",
tal_hex(tmpctx, msg));
@ -1952,7 +1986,13 @@ static void accept_tlv_add_offer(struct tlv_accept_tlvs *a_tlv,
*/
a_tlv->will_fund = tal(a_tlv, struct tlv_accept_tlvs_will_fund);
a_tlv->will_fund->lease_rates = *rates;
a_tlv->will_fund->signature = ad_sig;
a_tlv->will_fund->signature = *tx_state->lease_commit_sig;
tx_state->lease_expiry = lease_expiry;
tx_state->lease_chan_max_msat
= rates->channel_fee_max_base_msat;
tx_state->lease_chan_max_ppt
= rates->channel_fee_max_proportional_thousandths;
}
static void accepter_start(struct state *state, const u8 *oc2_msg)
@ -1962,7 +2002,7 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
struct channel_id cid, full_cid;
char *err_reason;
u8 *msg;
struct amount_sat total, requested_amt;
struct amount_sat total, requested_amt, lease_fee;
u32 lease_blockheight_start;
enum dualopend_wire msg_type;
struct tx_state *tx_state = state->tx_state;
@ -2186,9 +2226,10 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
* - MUST include a `will_fund` tlv
*/
if (open_tlv->request_funds && tx_state->rates)
accept_tlv_add_offer(a_tlv, tx_state->rates,
accept_tlv_add_offer(a_tlv, tx_state, tx_state->rates,
state->our_funding_pubkey,
lease_blockheight_start + LEASE_RATE_DURATION);
lease_blockheight_start);
msg = towire_accept_channel2(tmpctx, &state->channel_id,
tx_state->accepter_funding,
@ -2216,8 +2257,6 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
/* Add our fee to our amount now */
if (tx_state->rates) {
struct amount_sat lease_fee;
tx_state->lease_expiry
= lease_blockheight_start + LEASE_RATE_DURATION;
@ -2252,8 +2291,10 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
&lease_fee));
return;
}
} else
} else {
tx_state->lease_expiry = 0;
lease_fee = AMOUNT_SAT(0);
}
/* This is unused in this flow. We re-use
* the wire method between accepter + opener, so we set it
@ -2263,7 +2304,8 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
if (!run_tx_interactive(state, tx_state, &tx_state->psbt, TX_ACCEPTER))
return;
msg = accepter_commits(state, tx_state, total, &err_reason);
msg = accepter_commits(state, tx_state, total,
lease_fee, &err_reason);
if (!msg) {
if (err_reason)
negotiation_failed(state, "%s", err_reason);
@ -2300,6 +2342,7 @@ static void add_funding_output(struct tx_state *tx_state,
static u8 *opener_commits(struct state *state,
struct tx_state *tx_state,
struct amount_sat total,
struct amount_sat lease_fee,
char **err_reason)
{
struct channel_id cid;
@ -2333,6 +2376,7 @@ static u8 *opener_commits(struct state *state,
error = check_balances(tmpctx, state, tx_state,
tx_state->psbt,
lease_fee,
tx_state->feerate_per_kw_funding);
if (error) {
*err_reason = tal_fmt(tmpctx, "Insufficiently funded funding "
@ -2527,7 +2571,11 @@ static u8 *opener_commits(struct state *state,
tx_state->feerate_per_kw_funding,
state->feerate_per_kw_commitment,
state->upfront_shutdown_script[LOCAL],
state->upfront_shutdown_script[REMOTE]);
state->upfront_shutdown_script[REMOTE],
tx_state->lease_expiry,
tx_state->lease_commit_sig,
tx_state->lease_chan_max_msat,
tx_state->lease_chan_max_ppt);
}
@ -2537,7 +2585,7 @@ static void opener_start(struct state *state, u8 *msg)
struct tlv_accept_tlvs *a_tlv;
struct channel_id cid;
char *err_reason;
struct amount_sat total, requested_sats;
struct amount_sat total, requested_sats, lease_fee;
u32 current_blockheight;
bool dry_run;
struct tx_state *tx_state = state->tx_state;
@ -2697,7 +2745,6 @@ static void opener_start(struct state *state, u8 *msg)
if (open_tlv->request_funds && a_tlv->will_fund) {
char *err_msg;
struct lease_rates *rates = &a_tlv->will_fund->lease_rates;
struct amount_sat lease_fee;
tx_state->lease_expiry = current_blockheight + LEASE_RATE_DURATION;
@ -2749,8 +2796,16 @@ static void opener_start(struct state *state, u8 *msg)
&lease_fee));
return;
}
tx_state->lease_commit_sig
= tal_dup(tx_state, secp256k1_ecdsa_signature,
&a_tlv->will_fund->signature);
tx_state->lease_chan_max_msat
= rates->channel_fee_max_base_msat;
tx_state->lease_chan_max_ppt
= rates->channel_fee_max_proportional_thousandths;
} else
tx_state->lease_expiry = 0;
lease_fee = AMOUNT_SAT(0);
/* Check that total funding doesn't overflow */
if (!amount_sat_add(&total, tx_state->opener_funding,
@ -2815,7 +2870,7 @@ static void opener_start(struct state *state, u8 *msg)
if (!run_tx_interactive(state, tx_state, &tx_state->psbt, TX_INITIATOR))
return;
msg = opener_commits(state, tx_state, total, &err_reason);
msg = opener_commits(state, tx_state, total, lease_fee, &err_reason);
if (!msg) {
if (err_reason)
open_err_warn(state, "%s", err_reason);
@ -2914,9 +2969,12 @@ static void rbf_wrap_up(struct state *state,
psbt_txid(NULL, tx_state->psbt, &tx_state->funding_txid, NULL);
if (state->our_role == TX_ACCEPTER)
msg = accepter_commits(state, tx_state, total, &err_reason);
/* FIXME: lease fee rate !? */
msg = accepter_commits(state, tx_state, total,
AMOUNT_SAT(0), &err_reason);
else
msg = opener_commits(state, tx_state, total, &err_reason);
msg = opener_commits(state, tx_state, total,
AMOUNT_SAT(0), &err_reason);
if (!msg) {
if (err_reason)
@ -3726,7 +3784,11 @@ int main(int argc, char *argv[])
&state->upfront_shutdown_script[REMOTE],
&state->tx_state->remote_funding_sigs_rcvd,
&fee_states,
&state->channel_flags)) {
&state->channel_flags,
&state->tx_state->lease_expiry,
&state->tx_state->lease_commit_sig,
&state->tx_state->lease_chan_max_msat,
&state->tx_state->lease_chan_max_ppt)) {
/*~ We only reconnect on channels that the
* saved the the database (exchanged commitment sigs) */

View File

@ -65,6 +65,10 @@ msgdata,dualopend_reinit,remote_shutdown_scriptpubkey,u8,remote_shutdown_len
msgdata,dualopend_reinit,remote_funding_sigs_received,bool,
msgdata,dualopend_reinit,fee_states,fee_states,
msgdata,dualopend_reinit,channel_flags,u8,
msgdata,dualopend_reinit,lease_expiry,u32,
msgdata,dualopend_reinit,lease_commit_sig,?secp256k1_ecdsa_signature,
msgdata,dualopend_reinit,lease_chan_max_msat,u32,
msgdata,dualopend_reinit,lease_chan_max_ppt,u16,
# dualopend->master: they offered channel, should we continue?
msgtype,dualopend_got_offer,7005
@ -142,6 +146,10 @@ msgdata,dualopend_commit_rcvd,local_shutdown_len,u16,
msgdata,dualopend_commit_rcvd,local_shutdown_scriptpubkey,u8,local_shutdown_len
msgdata,dualopend_commit_rcvd,remote_shutdown_len,u16,
msgdata,dualopend_commit_rcvd,remote_shutdown_scriptpubkey,u8,remote_shutdown_len
msgdata,dualopend_commit_rcvd,lease_expiry,u32,
msgdata,dualopend_commit_rcvd,lease_commit_sig,?secp256k1_ecdsa_signature,
msgdata,dualopend_commit_rcvd,lease_chan_max_msat,u32,
msgdata,dualopend_commit_rcvd,lease_chan_max_ppt,u16,
# dualopend->master: peer updated the psbt
msgtype,dualopend_psbt_changed,7107

Can't render this file because it has a wrong number of fields in line 15.

View File

@ -152,7 +152,7 @@ bool fromwire_dualopend_init(const tal_t *ctx, const void *p, const struct chain
/* WIRE: DUALOPEND_REINIT */
/* master-dualopend: peer has reconnected */
u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, const struct channel_config *their_config, const struct channel_id *channel_id, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct pubkey *their_funding_pubkey, u32 minimum_depth, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 most_recent_feerate_per_kw_funding, struct amount_sat funding_satoshi, struct amount_msat our_funding, const struct basepoints *their_basepoints, const struct pubkey *remote_per_commit, const struct wally_psbt *funding_psbt, enum side opener, bool local_funding_locked, bool remote_funding_locked, bool send_shutdown, bool remote_shutdown_received, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, bool remote_funding_sigs_received, const struct fee_states *fee_states, u8 channel_flags)
u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, const struct channel_config *their_config, const struct channel_id *channel_id, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct pubkey *their_funding_pubkey, u32 minimum_depth, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 most_recent_feerate_per_kw_funding, struct amount_sat funding_satoshi, struct amount_msat our_funding, const struct basepoints *their_basepoints, const struct pubkey *remote_per_commit, const struct wally_psbt *funding_psbt, enum side opener, bool local_funding_locked, bool remote_funding_locked, bool send_shutdown, bool remote_shutdown_received, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, bool remote_funding_sigs_received, const struct fee_states *fee_states, u8 channel_flags, u32 lease_expiry, const secp256k1_ecdsa_signature *lease_commit_sig, u32 lease_chan_max_msat, u16 lease_chan_max_ppt)
{
u16 their_init_features_len = tal_count(their_init_features);
u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey);
@ -194,10 +194,19 @@ u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainpar
towire_bool(&p, remote_funding_sigs_received);
towire_fee_states(&p, fee_states);
towire_u8(&p, channel_flags);
towire_u32(&p, lease_expiry);
if (!lease_commit_sig)
towire_bool(&p, false);
else {
towire_bool(&p, true);
towire_secp256k1_ecdsa_signature(&p, lease_commit_sig);
}
towire_u32(&p, lease_chan_max_msat);
towire_u16(&p, lease_chan_max_ppt);
return memcheck(p, tal_count(p));
}
bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, struct channel_config *their_config, struct channel_id *channel_id, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct pubkey *their_funding_pubkey, u32 *minimum_depth, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *most_recent_feerate_per_kw_funding, struct amount_sat *funding_satoshi, struct amount_msat *our_funding, struct basepoints *their_basepoints, struct pubkey *remote_per_commit, struct wally_psbt **funding_psbt, enum side *opener, bool *local_funding_locked, bool *remote_funding_locked, bool *send_shutdown, bool *remote_shutdown_received, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, bool *remote_funding_sigs_received, struct fee_states **fee_states, u8 *channel_flags)
bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, struct channel_config *their_config, struct channel_id *channel_id, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct pubkey *their_funding_pubkey, u32 *minimum_depth, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *most_recent_feerate_per_kw_funding, struct amount_sat *funding_satoshi, struct amount_msat *our_funding, struct basepoints *their_basepoints, struct pubkey *remote_per_commit, struct wally_psbt **funding_psbt, enum side *opener, bool *local_funding_locked, bool *remote_funding_locked, bool *send_shutdown, bool *remote_shutdown_received, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, bool *remote_funding_sigs_received, struct fee_states **fee_states, u8 *channel_flags, u32 *lease_expiry, secp256k1_ecdsa_signature **lease_commit_sig, u32 *lease_chan_max_msat, u16 *lease_chan_max_ppt)
{
u16 their_init_features_len;
u16 local_shutdown_len;
@ -248,6 +257,15 @@ bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct cha
*remote_funding_sigs_received = fromwire_bool(&cursor, &plen);
*fee_states = fromwire_fee_states(ctx, &cursor, &plen);
*channel_flags = fromwire_u8(&cursor, &plen);
*lease_expiry = fromwire_u32(&cursor, &plen);
if (!fromwire_bool(&cursor, &plen))
*lease_commit_sig = NULL;
else {
*lease_commit_sig = tal(ctx, secp256k1_ecdsa_signature);
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, *lease_commit_sig);
}
*lease_chan_max_msat = fromwire_u32(&cursor, &plen);
*lease_chan_max_ppt = fromwire_u16(&cursor, &plen);
return cursor != NULL;
}
@ -474,7 +492,7 @@ bool fromwire_dualopend_rbf_init(const tal_t *ctx, const void *p, struct amount_
/* WIRE: DUALOPEND_COMMIT_RCVD */
/* dualopend->master: ready to commit channel open to database and */
/* get some signatures for the funding_tx. */
u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *their_config, const struct bitcoin_tx *remote_first_commit, const struct penalty_base *pbase, const struct bitcoin_signature *first_commit_sig, const struct wally_psbt *psbt, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *their_per_commit_point, const struct pubkey *remote_fundingkey, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshis, struct amount_sat our_funding_sats, u8 channel_flags, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey)
u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *their_config, const struct bitcoin_tx *remote_first_commit, const struct penalty_base *pbase, const struct bitcoin_signature *first_commit_sig, const struct wally_psbt *psbt, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *their_per_commit_point, const struct pubkey *remote_fundingkey, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshis, struct amount_sat our_funding_sats, u8 channel_flags, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, u32 lease_expiry, const secp256k1_ecdsa_signature *lease_commit_sig, u32 lease_chan_max_msat, u16 lease_chan_max_ppt)
{
u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey);
u16 remote_shutdown_len = tal_count(remote_shutdown_scriptpubkey);
@ -508,10 +526,19 @@ u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *
towire_u8_array(&p, local_shutdown_scriptpubkey, local_shutdown_len);
towire_u16(&p, remote_shutdown_len);
towire_u8_array(&p, remote_shutdown_scriptpubkey, remote_shutdown_len);
towire_u32(&p, lease_expiry);
if (!lease_commit_sig)
towire_bool(&p, false);
else {
towire_bool(&p, true);
towire_secp256k1_ecdsa_signature(&p, lease_commit_sig);
}
towire_u32(&p, lease_chan_max_msat);
towire_u16(&p, lease_chan_max_ppt);
return memcheck(p, tal_count(p));
}
bool fromwire_dualopend_commit_rcvd(const tal_t *ctx, const void *p, struct channel_config *their_config, struct bitcoin_tx **remote_first_commit, struct penalty_base **pbase, struct bitcoin_signature *first_commit_sig, struct wally_psbt **psbt, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *their_per_commit_point, struct pubkey *remote_fundingkey, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshis, struct amount_sat *our_funding_sats, u8 *channel_flags, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey)
bool fromwire_dualopend_commit_rcvd(const tal_t *ctx, const void *p, struct channel_config *their_config, struct bitcoin_tx **remote_first_commit, struct penalty_base **pbase, struct bitcoin_signature *first_commit_sig, struct wally_psbt **psbt, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *their_per_commit_point, struct pubkey *remote_fundingkey, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshis, struct amount_sat *our_funding_sats, u8 *channel_flags, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, u32 *lease_expiry, secp256k1_ecdsa_signature **lease_commit_sig, u32 *lease_chan_max_msat, u16 *lease_chan_max_ppt)
{
u16 local_shutdown_len;
u16 remote_shutdown_len;
@ -552,6 +579,15 @@ bool fromwire_dualopend_commit_rcvd(const tal_t *ctx, const void *p, struct chan
// 2nd case remote_shutdown_scriptpubkey
*remote_shutdown_scriptpubkey = remote_shutdown_len ? tal_arr(ctx, u8, remote_shutdown_len) : NULL;
fromwire_u8_array(&cursor, &plen, *remote_shutdown_scriptpubkey, remote_shutdown_len);
*lease_expiry = fromwire_u32(&cursor, &plen);
if (!fromwire_bool(&cursor, &plen))
*lease_commit_sig = NULL;
else {
*lease_commit_sig = tal(ctx, secp256k1_ecdsa_signature);
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, *lease_commit_sig);
}
*lease_chan_max_msat = fromwire_u32(&cursor, &plen);
*lease_chan_max_ppt = fromwire_u16(&cursor, &plen);
return cursor != NULL;
}
@ -1038,4 +1074,4 @@ bool fromwire_dualopend_validate_lease_reply(const tal_t *ctx, const void *p, wi
}
return cursor != NULL;
}
// SHA256STAMP:41650a0d42866067279024744de6ef7e52ff0ef5a406c4be3b702f1ecf11e556
// SHA256STAMP:ee275d023d9d8ba7e520d321908da0228f76e7ca0d6f76908d17e967177f16c8

View File

@ -98,8 +98,8 @@ bool fromwire_dualopend_init(const tal_t *ctx, const void *p, const struct chain
/* WIRE: DUALOPEND_REINIT */
/* master-dualopend: peer has reconnected */
u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, const struct channel_config *their_config, const struct channel_id *channel_id, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct pubkey *their_funding_pubkey, u32 minimum_depth, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 most_recent_feerate_per_kw_funding, struct amount_sat funding_satoshi, struct amount_msat our_funding, const struct basepoints *their_basepoints, const struct pubkey *remote_per_commit, const struct wally_psbt *funding_psbt, enum side opener, bool local_funding_locked, bool remote_funding_locked, bool send_shutdown, bool remote_shutdown_received, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, bool remote_funding_sigs_received, const struct fee_states *fee_states, u8 channel_flags);
bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, struct channel_config *their_config, struct channel_id *channel_id, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct pubkey *their_funding_pubkey, u32 *minimum_depth, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *most_recent_feerate_per_kw_funding, struct amount_sat *funding_satoshi, struct amount_msat *our_funding, struct basepoints *their_basepoints, struct pubkey *remote_per_commit, struct wally_psbt **funding_psbt, enum side *opener, bool *local_funding_locked, bool *remote_funding_locked, bool *send_shutdown, bool *remote_shutdown_received, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, bool *remote_funding_sigs_received, struct fee_states **fee_states, u8 *channel_flags);
u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, const struct channel_config *their_config, const struct channel_id *channel_id, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct pubkey *their_funding_pubkey, u32 minimum_depth, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 most_recent_feerate_per_kw_funding, struct amount_sat funding_satoshi, struct amount_msat our_funding, const struct basepoints *their_basepoints, const struct pubkey *remote_per_commit, const struct wally_psbt *funding_psbt, enum side opener, bool local_funding_locked, bool remote_funding_locked, bool send_shutdown, bool remote_shutdown_received, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, bool remote_funding_sigs_received, const struct fee_states *fee_states, u8 channel_flags, u32 lease_expiry, const secp256k1_ecdsa_signature *lease_commit_sig, u32 lease_chan_max_msat, u16 lease_chan_max_ppt);
bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, struct channel_config *their_config, struct channel_id *channel_id, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct pubkey *their_funding_pubkey, u32 *minimum_depth, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *most_recent_feerate_per_kw_funding, struct amount_sat *funding_satoshi, struct amount_msat *our_funding, struct basepoints *their_basepoints, struct pubkey *remote_per_commit, struct wally_psbt **funding_psbt, enum side *opener, bool *local_funding_locked, bool *remote_funding_locked, bool *send_shutdown, bool *remote_shutdown_received, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, bool *remote_funding_sigs_received, struct fee_states **fee_states, u8 *channel_flags, u32 *lease_expiry, secp256k1_ecdsa_signature **lease_commit_sig, u32 *lease_chan_max_msat, u16 *lease_chan_max_ppt);
/* WIRE: DUALOPEND_GOT_OFFER */
/* dualopend->master: they offered channel */
@ -139,8 +139,8 @@ bool fromwire_dualopend_rbf_init(const tal_t *ctx, const void *p, struct amount_
/* WIRE: DUALOPEND_COMMIT_RCVD */
/* dualopend->master: ready to commit channel open to database and */
/* get some signatures for the funding_tx. */
u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *their_config, const struct bitcoin_tx *remote_first_commit, const struct penalty_base *pbase, const struct bitcoin_signature *first_commit_sig, const struct wally_psbt *psbt, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *their_per_commit_point, const struct pubkey *remote_fundingkey, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshis, struct amount_sat our_funding_sats, u8 channel_flags, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey);
bool fromwire_dualopend_commit_rcvd(const tal_t *ctx, const void *p, struct channel_config *their_config, struct bitcoin_tx **remote_first_commit, struct penalty_base **pbase, struct bitcoin_signature *first_commit_sig, struct wally_psbt **psbt, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *their_per_commit_point, struct pubkey *remote_fundingkey, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshis, struct amount_sat *our_funding_sats, u8 *channel_flags, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey);
u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *their_config, const struct bitcoin_tx *remote_first_commit, const struct penalty_base *pbase, const struct bitcoin_signature *first_commit_sig, const struct wally_psbt *psbt, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *their_per_commit_point, const struct pubkey *remote_fundingkey, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshis, struct amount_sat our_funding_sats, u8 channel_flags, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, u32 lease_expiry, const secp256k1_ecdsa_signature *lease_commit_sig, u32 lease_chan_max_msat, u16 lease_chan_max_ppt);
bool fromwire_dualopend_commit_rcvd(const tal_t *ctx, const void *p, struct channel_config *their_config, struct bitcoin_tx **remote_first_commit, struct penalty_base **pbase, struct bitcoin_signature *first_commit_sig, struct wally_psbt **psbt, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *their_per_commit_point, struct pubkey *remote_fundingkey, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshis, struct amount_sat *our_funding_sats, u8 *channel_flags, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, u32 *lease_expiry, secp256k1_ecdsa_signature **lease_commit_sig, u32 *lease_chan_max_msat, u16 *lease_chan_max_ppt);
/* WIRE: DUALOPEND_PSBT_CHANGED */
/* dualopend->master: peer updated the psbt */
@ -237,4 +237,4 @@ bool fromwire_dualopend_validate_lease_reply(const tal_t *ctx, const void *p, wi
#endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */
// SHA256STAMP:41650a0d42866067279024744de6ef7e52ff0ef5a406c4be3b702f1ecf11e556
// SHA256STAMP:ee275d023d9d8ba7e520d321908da0228f76e7ca0d6f76908d17e967177f16c8

View File

@ -728,6 +728,14 @@ static struct migration dbmigrations[] = {
" local_static_remotekey_start = 9223372036854775807"
" WHERE option_static_remotekey = 0"),
NULL},
{SQL("ALTER TABLE channel_funding_inflights ADD lease_commit_sig BLOB DEFAULT NULL"), NULL},
{SQL("ALTER TABLE channel_funding_inflights ADD lease_chan_max_msat BIGINT DEFAULT NULL"), NULL},
{SQL("ALTER TABLE channel_funding_inflights ADD lease_chan_max_ppt INTEGER DEFAULT NULL"), NULL},
{SQL("ALTER TABLE channel_funding_inflights ADD lease_expiry INTEGER DEFAULT 0"), NULL},
{SQL("ALTER TABLE channels ADD lease_commit_sig BLOB DEFAULT NULL"), NULL},
{SQL("ALTER TABLE channels ADD lease_chan_max_msat INTEGER DEFAULT NULL"), NULL},
{SQL("ALTER TABLE channels ADD lease_chan_max_ppt INTEGER DEFAULT NULL"), NULL},
{SQL("ALTER TABLE channels ADD lease_expiry INTEGER DEFAULT 0"), NULL},
};
/* Leak tracking. */

View File

@ -956,6 +956,54 @@ struct db_query db_postgres_queries[] = {
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channel_funding_inflights ADD lease_commit_sig BLOB DEFAULT NULL",
.query = "ALTER TABLE channel_funding_inflights ADD lease_commit_sig BYTEA DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_msat BIGINT DEFAULT NULL",
.query = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_msat BIGINT DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_ppt INTEGER DEFAULT NULL",
.query = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_ppt INTEGER DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channel_funding_inflights ADD lease_expiry INTEGER DEFAULT 0",
.query = "ALTER TABLE channel_funding_inflights ADD lease_expiry INTEGER DEFAULT 0",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD lease_commit_sig BLOB DEFAULT NULL",
.query = "ALTER TABLE channels ADD lease_commit_sig BYTEA DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD lease_chan_max_msat INTEGER DEFAULT NULL",
.query = "ALTER TABLE channels ADD lease_chan_max_msat INTEGER DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD lease_chan_max_ppt INTEGER DEFAULT NULL",
.query = "ALTER TABLE channels ADD lease_chan_max_ppt INTEGER DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD lease_expiry INTEGER DEFAULT 0",
.query = "ALTER TABLE channels ADD lease_expiry INTEGER DEFAULT 0",
.placeholders = 0,
.readonly = false,
},
{
.name = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?",
.query = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = $1",
@ -1311,8 +1359,8 @@ struct db_query db_postgres_queries[] = {
.readonly = false,
},
{
.name = "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",
.query = "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 = $1 ORDER BY funding_feerate",
.name = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate",
.query = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channel_funding_inflights WHERE channel_id = $1 ORDER BY funding_feerate",
.placeholders = 1,
.readonly = true,
},
@ -1323,8 +1371,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, 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;",
.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, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt 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, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channels WHERE state != $1;",
.placeholders = 1,
.readonly = true,
},
@ -1389,9 +1437,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=?, 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,
.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=?, lease_expiry=?, lease_commit_sig=?, lease_chan_max_msat=?, lease_chan_max_ppt=? 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, lease_expiry=$39, lease_commit_sig=$40, lease_chan_max_msat=$41, lease_chan_max_ppt=$42 WHERE id=$43",
.placeholders = 43,
.readonly = false,
},
{
@ -1918,10 +1966,10 @@ struct db_query db_postgres_queries[] = {
},
};
#define DB_POSTGRES_QUERY_COUNT 318
#define DB_POSTGRES_QUERY_COUNT 326
#endif /* HAVE_POSTGRES */
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
// SHA256STAMP:8f8494fdeb030b724d84aa26c0377e7e488ad40e4b1370db7d02470ac29c4ec8
// SHA256STAMP:85d581977cc3b124df4c81058cab78f13938dfa0cb4845526bb121e396bcf97d

View File

@ -956,6 +956,54 @@ struct db_query db_sqlite3_queries[] = {
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channel_funding_inflights ADD lease_commit_sig BLOB DEFAULT NULL",
.query = "ALTER TABLE channel_funding_inflights ADD lease_commit_sig BLOB DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_msat BIGINT DEFAULT NULL",
.query = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_msat INTEGER DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_ppt INTEGER DEFAULT NULL",
.query = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_ppt INTEGER DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channel_funding_inflights ADD lease_expiry INTEGER DEFAULT 0",
.query = "ALTER TABLE channel_funding_inflights ADD lease_expiry INTEGER DEFAULT 0",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD lease_commit_sig BLOB DEFAULT NULL",
.query = "ALTER TABLE channels ADD lease_commit_sig BLOB DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD lease_chan_max_msat INTEGER DEFAULT NULL",
.query = "ALTER TABLE channels ADD lease_chan_max_msat INTEGER DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD lease_chan_max_ppt INTEGER DEFAULT NULL",
.query = "ALTER TABLE channels ADD lease_chan_max_ppt INTEGER DEFAULT NULL",
.placeholders = 0,
.readonly = false,
},
{
.name = "ALTER TABLE channels ADD lease_expiry INTEGER DEFAULT 0",
.query = "ALTER TABLE channels ADD lease_expiry INTEGER DEFAULT 0",
.placeholders = 0,
.readonly = false,
},
{
.name = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?",
.query = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?",
@ -1311,8 +1359,8 @@ struct db_query db_sqlite3_queries[] = {
.readonly = false,
},
{
.name = "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",
.query = "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",
.name = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate",
.query = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate",
.placeholders = 1,
.readonly = true,
},
@ -1323,8 +1371,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, 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 != ?;",
.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, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt 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, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channels WHERE state != ?;",
.placeholders = 1,
.readonly = true,
},
@ -1389,9 +1437,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=?, 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,
.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=?, lease_expiry=?, lease_commit_sig=?, lease_chan_max_msat=?, lease_chan_max_ppt=? 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=?, lease_expiry=?, lease_commit_sig=?, lease_chan_max_msat=?, lease_chan_max_ppt=? WHERE id=?",
.placeholders = 43,
.readonly = false,
},
{
@ -1918,10 +1966,10 @@ struct db_query db_sqlite3_queries[] = {
},
};
#define DB_SQLITE3_QUERY_COUNT 318
#define DB_SQLITE3_QUERY_COUNT 326
#endif /* HAVE_SQLITE3 */
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
// SHA256STAMP:8f8494fdeb030b724d84aa26c0377e7e488ad40e4b1370db7d02470ac29c4ec8
// SHA256STAMP:85d581977cc3b124df4c81058cab78f13938dfa0cb4845526bb121e396bcf97d

View File

@ -630,83 +630,115 @@ msgstr ""
msgid "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 0"
msgstr ""
#: wallet/db.c:957
#: wallet/db.c:731
msgid "ALTER TABLE channel_funding_inflights ADD lease_commit_sig BLOB DEFAULT NULL"
msgstr ""
#: wallet/db.c:732
msgid "ALTER TABLE channel_funding_inflights ADD lease_chan_max_msat BIGINT DEFAULT NULL"
msgstr ""
#: wallet/db.c:733
msgid "ALTER TABLE channel_funding_inflights ADD lease_chan_max_ppt INTEGER DEFAULT NULL"
msgstr ""
#: wallet/db.c:734
msgid "ALTER TABLE channel_funding_inflights ADD lease_expiry INTEGER DEFAULT 0"
msgstr ""
#: wallet/db.c:735
msgid "ALTER TABLE channels ADD lease_commit_sig BLOB DEFAULT NULL"
msgstr ""
#: wallet/db.c:736
msgid "ALTER TABLE channels ADD lease_chan_max_msat INTEGER DEFAULT NULL"
msgstr ""
#: wallet/db.c:737
msgid "ALTER TABLE channels ADD lease_chan_max_ppt INTEGER DEFAULT NULL"
msgstr ""
#: wallet/db.c:738
msgid "ALTER TABLE channels ADD lease_expiry INTEGER DEFAULT 0"
msgstr ""
#: wallet/db.c:965
msgid "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?"
msgstr ""
#: wallet/db.c:1057
#: wallet/db.c:1065
msgid "SELECT version FROM version LIMIT 1"
msgstr ""
#: wallet/db.c:1119
#: wallet/db.c:1127
msgid "UPDATE version SET version=?;"
msgstr ""
#: wallet/db.c:1127
#: wallet/db.c:1135
msgid "INSERT INTO db_upgrades VALUES (?, ?);"
msgstr ""
#: wallet/db.c:1139
#: wallet/db.c:1147
msgid "SELECT intval FROM vars WHERE name = 'data_version'"
msgstr ""
#: wallet/db.c:1166
#: wallet/db.c:1174
msgid "SELECT intval FROM vars WHERE name= ? LIMIT 1"
msgstr ""
#: wallet/db.c:1182
#: wallet/db.c:1190
msgid "UPDATE vars SET intval=? WHERE name=?;"
msgstr ""
#: wallet/db.c:1191
#: wallet/db.c:1199
msgid "INSERT INTO vars (name, intval) VALUES (?, ?);"
msgstr ""
#: wallet/db.c:1205
#: wallet/db.c:1213
msgid "UPDATE channels SET feerate_base = ?, feerate_ppm = ?;"
msgstr ""
#: wallet/db.c:1226
#: wallet/db.c:1234
msgid "UPDATE channels SET our_funding_satoshi = funding_satoshi WHERE funder = 0;"
msgstr ""
#: wallet/db.c:1242
#: wallet/db.c:1250
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:1304
#: wallet/db.c:1312
msgid "UPDATE outputs SET scriptpubkey = ? WHERE prev_out_tx = ? AND prev_out_index = ?"
msgstr ""
#: wallet/db.c:1329
#: wallet/db.c:1337
msgid "SELECT id, funding_tx_id, funding_tx_outnum FROM channels;"
msgstr ""
#: wallet/db.c:1348
#: wallet/db.c:1356
msgid "UPDATE channels SET full_channel_id = ? WHERE id = ?;"
msgstr ""
#: wallet/db.c:1369
#: wallet/db.c:1377
msgid "SELECT channels.id, peers.node_id FROM channels JOIN peers ON (peers.id = channels.peer_id)"
msgstr ""
#: wallet/db.c:1402
#: wallet/db.c:1410
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:1428
#: wallet/db.c:1436
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:1495
#: wallet/db.c:1503
msgid "UPDATE channel_funding_inflights SET last_tx = ? WHERE channel_id = ? AND funding_tx_id = ?;"
msgstr ""
#: wallet/db.c:1519
#: wallet/db.c:1527
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:1586
#: wallet/db.c:1594
msgid "UPDATE channels SET last_tx = ? WHERE id = ?;"
msgstr ""
@ -866,391 +898,391 @@ msgstr ""
msgid "DELETE FROM channel_funding_inflights WHERE channel_id = ?"
msgstr ""
#: wallet/wallet.c:1079
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"
#: wallet/wallet.c:1098
msgid "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate"
msgstr ""
#: wallet/wallet.c:1309
#: wallet/wallet.c:1350
msgid "SELECT id FROM channels ORDER BY id DESC LIMIT 1;"
msgstr ""
#: 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 != ?;"
#: wallet/wallet.c:1367
msgid "SELECT id, peer_id, short_channel_id, full_channel_id, channel_config_local, channel_config_remote, state, funder, channel_flags, minimum_depth, next_index_local, next_index_remote, next_htlc_id, funding_tx_id, funding_tx_outnum, funding_satoshi, our_funding_satoshi, funding_locked_remote, push_msatoshi, msatoshi_local, fundingkey_remote, revocation_basepoint_remote, payment_basepoint_remote, htlc_basepoint_remote, delayed_payment_basepoint_remote, per_commit_remote, old_per_commit_remote, local_feerate_per_kw, remote_feerate_per_kw, shachain_remote_id, shutdown_scriptpubkey_remote, shutdown_keyidx_local, last_sent_commit_state, last_sent_commit_id, last_tx, last_sig, last_was_revoke, first_blocknum, min_possible_feerate, max_possible_feerate, msatoshi_to_us_min, msatoshi_to_us_max, future_per_commitment_point, last_sent_commit, feerate_base, feerate_ppm, remote_upfront_shutdown_script, local_static_remotekey_start, remote_static_remotekey_start, option_anchor_outputs, shutdown_scriptpubkey_local, closer, state_change_reason, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local, shutdown_wrong_txid, shutdown_wrong_outnum, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channels WHERE state != ?;"
msgstr ""
#: wallet/wallet.c:1434
#: wallet/wallet.c:1479
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:1440
#: wallet/wallet.c:1485
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:1446
#: wallet/wallet.c:1491
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:1452
#: wallet/wallet.c:1497
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:1497
#: wallet/wallet.c:1542
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:1526
#: wallet/wallet.c:1571
msgid "SELECT MIN(height), MAX(height) FROM blocks;"
msgstr ""
#: wallet/wallet.c:1548
#: wallet/wallet.c:1593
msgid "INSERT INTO channel_configs DEFAULT VALUES;"
msgstr ""
#: wallet/wallet.c:1560
#: wallet/wallet.c:1605
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:1584
#: wallet/wallet.c:1629
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:1618
#: wallet/wallet.c:1663
msgid "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?"
msgstr ""
#: 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=?"
#: wallet/wallet.c:1682
msgid "UPDATE channels SET shachain_remote_id=?, short_channel_id=?, full_channel_id=?, state=?, funder=?, channel_flags=?, minimum_depth=?, next_index_local=?, next_index_remote=?, next_htlc_id=?, funding_tx_id=?, funding_tx_outnum=?, funding_satoshi=?, our_funding_satoshi=?, funding_locked_remote=?, push_msatoshi=?, msatoshi_local=?, shutdown_scriptpubkey_remote=?, shutdown_keyidx_local=?, channel_config_local=?, last_tx=?, last_sig=?, last_was_revoke=?, min_possible_feerate=?, max_possible_feerate=?, msatoshi_to_us_min=?, msatoshi_to_us_max=?, feerate_base=?, feerate_ppm=?, remote_upfront_shutdown_script=?, local_static_remotekey_start=?, remote_static_remotekey_start=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=?, lease_expiry=?, lease_commit_sig=?, lease_chan_max_msat=?, lease_chan_max_ppt=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1731
#: wallet/wallet.c:1791
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:1758
#: wallet/wallet.c:1818
msgid "DELETE FROM channel_feerates WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1768
#: wallet/wallet.c:1828
msgid "INSERT INTO channel_feerates VALUES(?, ?, ?)"
msgstr ""
#: wallet/wallet.c:1785
#: wallet/wallet.c:1845
msgid "UPDATE channels SET last_sent_commit=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:1808
#: wallet/wallet.c:1868
msgid "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:1836
#: wallet/wallet.c:1896
msgid "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;"
msgstr ""
#: wallet/wallet.c:1865
#: wallet/wallet.c:1925
msgid "SELECT id FROM peers WHERE node_id = ?"
msgstr ""
#: wallet/wallet.c:1877
#: wallet/wallet.c:1937
msgid "UPDATE peers SET address = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:1886
#: wallet/wallet.c:1946
msgid "INSERT INTO peers (node_id, address) VALUES (?, ?);"
msgstr ""
#: wallet/wallet.c:1907
#: wallet/wallet.c:1967
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:1948
#: wallet/wallet.c:2008
msgid "DELETE FROM channel_htlcs WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1954
#: wallet/wallet.c:2014
msgid "DELETE FROM htlc_sigs WHERE channelid=?"
msgstr ""
#: wallet/wallet.c:1960
#: wallet/wallet.c:2020
msgid "DELETE FROM channeltxs WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1967
#: wallet/wallet.c:2027
msgid "DELETE FROM channel_funding_inflights WHERE channel_id=?"
msgstr ""
#: wallet/wallet.c:1973
#: wallet/wallet.c:2033
msgid "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)"
msgstr ""
#: wallet/wallet.c:1983
#: wallet/wallet.c:2043
msgid "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?"
msgstr ""
#: wallet/wallet.c:1997
#: wallet/wallet.c:2057
msgid "SELECT * FROM channels WHERE peer_id = ?;"
msgstr ""
#: wallet/wallet.c:2005
#: wallet/wallet.c:2065
msgid "DELETE FROM peers WHERE id=?"
msgstr ""
#: wallet/wallet.c:2016
#: wallet/wallet.c:2076
msgid "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?"
msgstr ""
#: wallet/wallet.c:2119
#: wallet/wallet.c:2179
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:2172
#: wallet/wallet.c:2232
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:2233
#: wallet/wallet.c:2293
msgid "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?"
msgstr ""
#: wallet/wallet.c:2450
#: wallet/wallet.c:2510
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:2497
#: wallet/wallet.c:2557
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:2628
#: wallet/wallet.c:2688
msgid "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;"
msgstr ""
#: wallet/wallet.c:2662
#: wallet/wallet.c:2722
msgid "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2715
#: wallet/wallet.c:2775
msgid "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:2733
#: wallet/wallet.c:2793
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:2822
#: wallet/wallet.c:2882
msgid "DELETE FROM payments WHERE payment_hash = ? AND partid = ?"
msgstr ""
#: wallet/wallet.c:2836
#: wallet/wallet.c:2896
msgid "DELETE FROM payments WHERE payment_hash = ?"
msgstr ""
#: wallet/wallet.c:2937
#: wallet/wallet.c:2997
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:2987
#: wallet/wallet.c:3047
msgid "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?"
msgstr ""
#: wallet/wallet.c:2997
#: wallet/wallet.c:3057
msgid "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?"
msgstr ""
#: wallet/wallet.c:3007
#: wallet/wallet.c:3067
msgid "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;"
msgstr ""
#: wallet/wallet.c:3039
#: wallet/wallet.c:3099
msgid "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;"
msgstr ""
#: wallet/wallet.c:3106
#: wallet/wallet.c:3166
msgid "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;"
msgstr ""
#: wallet/wallet.c:3165
#: wallet/wallet.c:3225
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:3188
#: wallet/wallet.c:3248
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:3239
#: wallet/wallet.c:3299
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:3284
#: wallet/wallet.c:3344
msgid "DELETE FROM htlc_sigs WHERE channelid = ?"
msgstr ""
#: wallet/wallet.c:3291
#: wallet/wallet.c:3351
msgid "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)"
msgstr ""
#: wallet/wallet.c:3303
#: wallet/wallet.c:3363
msgid "SELECT blobval FROM vars WHERE name='genesis_hash'"
msgstr ""
#: wallet/wallet.c:3327
#: wallet/wallet.c:3387
msgid "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);"
msgstr ""
#: wallet/wallet.c:3345
#: wallet/wallet.c:3405
msgid "SELECT txid, outnum FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3357
#: wallet/wallet.c:3417
msgid "DELETE FROM utxoset WHERE spendheight < ?"
msgstr ""
#: wallet/wallet.c:3365 wallet/wallet.c:3479
#: wallet/wallet.c:3425 wallet/wallet.c:3539
msgid "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3384
#: wallet/wallet.c:3444
msgid "DELETE FROM blocks WHERE hash = ?"
msgstr ""
#: wallet/wallet.c:3390
#: wallet/wallet.c:3450
msgid "SELECT * FROM blocks WHERE height >= ?;"
msgstr ""
#: wallet/wallet.c:3399
#: wallet/wallet.c:3459
msgid "DELETE FROM blocks WHERE height > ?"
msgstr ""
#: wallet/wallet.c:3411
#: wallet/wallet.c:3471
msgid "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?"
msgstr ""
#: wallet/wallet.c:3429
#: wallet/wallet.c:3489
msgid "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?"
msgstr ""
#: wallet/wallet.c:3452 wallet/wallet.c:3490
#: wallet/wallet.c:3512 wallet/wallet.c:3550
msgid "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3516
#: wallet/wallet.c:3576
msgid "SELECT height FROM blocks WHERE height = ?"
msgstr ""
#: wallet/wallet.c:3529
#: wallet/wallet.c:3589
msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL"
msgstr ""
#: wallet/wallet.c:3571
#: wallet/wallet.c:3631
msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?"
msgstr ""
#: wallet/wallet.c:3602 wallet/wallet.c:3762
#: wallet/wallet.c:3662 wallet/wallet.c:3822
msgid "SELECT blockheight FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3612
#: wallet/wallet.c:3672
msgid "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3633
#: wallet/wallet.c:3693
msgid "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3650
#: wallet/wallet.c:3710
msgid "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;"
msgstr ""
#: wallet/wallet.c:3682
#: wallet/wallet.c:3742
msgid "SELECT type, channel_id FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3698
#: wallet/wallet.c:3758
msgid "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?"
msgstr ""
#: wallet/wallet.c:3717
#: wallet/wallet.c:3777
msgid "SELECT type FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3740
#: wallet/wallet.c:3800
msgid "SELECT rawtx FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3786
#: wallet/wallet.c:3846
msgid "SELECT blockheight, txindex FROM transactions WHERE id=?"
msgstr ""
#: wallet/wallet.c:3814
#: wallet/wallet.c:3874
msgid "SELECT id FROM transactions WHERE blockheight=?"
msgstr ""
#: wallet/wallet.c:3833
#: wallet/wallet.c:3893
msgid "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:3857
#: wallet/wallet.c:3917
msgid "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;"
msgstr ""
#: wallet/wallet.c:3878
#: wallet/wallet.c:3938
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:3923
#: wallet/wallet.c:3983
msgid "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?"
msgstr ""
#: wallet/wallet.c:3981
#: wallet/wallet.c:4041
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:4040
#: wallet/wallet.c:4100
msgid "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;"
msgstr ""
#: wallet/wallet.c:4089
#: wallet/wallet.c:4149
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:4211
#: wallet/wallet.c:4271
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:4305
#: wallet/wallet.c:4365
msgid "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4330
#: wallet/wallet.c:4390
msgid "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?"
msgstr ""
#: wallet/wallet.c:4354
#: wallet/wallet.c:4414
msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?"
msgstr ""
#: wallet/wallet.c:4372
#: wallet/wallet.c:4432
msgid "SELECT 1 FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4385
#: wallet/wallet.c:4445
msgid "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);"
msgstr ""
#: wallet/wallet.c:4412
#: wallet/wallet.c:4472
msgid "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4440
#: wallet/wallet.c:4500
msgid "SELECT offer_id FROM offers;"
msgstr ""
#: wallet/wallet.c:4466
#: wallet/wallet.c:4526
msgid "UPDATE offers SET status=? WHERE offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4477
#: wallet/wallet.c:4537
msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;"
msgstr ""
#: wallet/wallet.c:4505
#: wallet/wallet.c:4565
msgid "SELECT status FROM offers WHERE offer_id = ?;"
msgstr ""
@ -1266,7 +1298,7 @@ msgstr ""
msgid "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = ?;"
msgstr ""
#: wallet/test/run-wallet.c:1649
#: wallet/test/run-wallet.c:1653
msgid "INSERT INTO channels (id) VALUES (1);"
msgstr ""
# SHA256STAMP:cc1be3f6b134130e9c0251467bd7ecb8a7cdb20f3026bdd26fcf5b286872ef2c
# SHA256STAMP:c11c71bfdabd0f5e28d6d8b7539e2a1b7315206fb4df5c2870a658ea9c66c1c6

View File

@ -1541,7 +1541,9 @@ static bool test_channel_inflight_crud(struct lightningd *ld, const tal_t *ctx)
&pk, NULL,
1000, 100,
NULL, 0, 0, true,
LOCAL, REASON_UNKNOWN, NULL);
LOCAL, REASON_UNKNOWN, NULL,
100, NULL,
7777, 22);
db_begin_transaction(w->db);
CHECK(!wallet_err);
wallet_channel_insert(w, chan);
@ -1557,7 +1559,8 @@ static bool test_channel_inflight_crud(struct lightningd *ld, const tal_t *ctx)
our_sats,
funding_psbt,
last_tx,
sig);
sig,
1, NULL, 2, 4);
/* do inflights get correctly added to the channel? */
wallet_inflight_add(w, inflight);
@ -1578,7 +1581,8 @@ static bool test_channel_inflight_crud(struct lightningd *ld, const tal_t *ctx)
our_sats,
funding_psbt,
last_tx,
sig);
sig,
1, NULL, 2, 4);
wallet_inflight_add(w, inflight);
CHECK_MSG(c2 = wallet_channel_load(w, chan->dbid),
tal_fmt(w, "Load from DB"));

View File

@ -1048,6 +1048,10 @@ wallet_stmt2inflight(struct wallet *w, struct db_stmt *stmt,
struct bitcoin_signature last_sig;
struct channel_inflight *inflight;
secp256k1_ecdsa_signature *lease_commit_sig;
u32 lease_chan_max_msat;
u16 lease_chan_max_ppt;
db_column_txid(stmt, 0, &funding_txid);
db_column_amount_sat(stmt, 3, &funding_sat);
db_column_amount_sat(stmt, 4, &our_funding_sat);
@ -1056,6 +1060,17 @@ wallet_stmt2inflight(struct wallet *w, struct db_stmt *stmt,
last_sig.sighash_type = SIGHASH_ALL;
if (!db_column_is_null(stmt, 10)) {
lease_commit_sig = tal(tmpctx, secp256k1_ecdsa_signature);
db_column_signature(stmt, 10, lease_commit_sig);
lease_chan_max_msat = db_column_int(stmt, 11);
lease_chan_max_ppt = db_column_int(stmt, 12);
} else {
lease_commit_sig = NULL;
lease_chan_max_msat = 0;
lease_chan_max_ppt = 0;
}
inflight = new_inflight(chan, funding_txid,
db_column_int(stmt, 1),
db_column_int(stmt, 2),
@ -1063,7 +1078,11 @@ wallet_stmt2inflight(struct wallet *w, struct db_stmt *stmt,
our_funding_sat,
db_column_psbt(tmpctx, stmt, 5),
db_column_psbt_to_tx(tmpctx, stmt, 6),
last_sig);
last_sig,
db_column_int(stmt, 9),
lease_commit_sig,
lease_chan_max_msat,
lease_chan_max_ppt);
/* Pull out the serialized tx-sigs-received-ness */
inflight->remote_tx_sigs = db_column_int(stmt, 8);
@ -1086,6 +1105,10 @@ static bool wallet_channel_load_inflights(struct wallet *w,
", last_tx" // 6
", last_sig" // 7
", funding_tx_remote_sigs_received" //8
", lease_expiry" // 9
", lease_commit_sig" // 10
", lease_chan_max_msat" // 11
", lease_chan_max_ppt" // 12
" FROM channel_funding_inflights"
" WHERE channel_id = ?" // ?0
" ORDER BY funding_feerate"));
@ -1133,6 +1156,9 @@ 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;
secp256k1_ecdsa_signature *lease_commit_sig;
u32 lease_chan_max_msat;
u16 lease_chan_max_ppt;
peer_dbid = db_column_u64(stmt, 1);
peer = find_peer_by_dbid(w->ld, peer_dbid);
@ -1242,6 +1268,17 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm
db_column_amount_msat(stmt, 40, &msat_to_us_min);
db_column_amount_msat(stmt, 41, &msat_to_us_max);
if (!db_column_is_null(stmt, 61)) {
lease_commit_sig = tal(w, secp256k1_ecdsa_signature);
db_column_signature(stmt, 61, lease_commit_sig);
lease_chan_max_msat = db_column_int(stmt, 62);
lease_chan_max_ppt = db_column_int(stmt, 63);
} else {
lease_commit_sig = NULL;
lease_chan_max_msat = 0;
lease_chan_max_ppt = 0;
}
chan = new_channel(peer, db_column_u64(stmt, 0),
&wshachain,
db_column_int(stmt, 6),
@ -1292,7 +1329,11 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm
db_column_int(stmt, 49),
db_column_int(stmt, 51),
db_column_int(stmt, 52),
shutdown_wrong_funding);
shutdown_wrong_funding,
db_column_int(stmt, 60),
lease_commit_sig,
lease_chan_max_msat,
lease_chan_max_ppt);
if (!wallet_channel_load_inflights(w, chan)) {
tal_free(chan);
@ -1384,6 +1425,10 @@ static bool wallet_channels_load_active(struct wallet *w)
", funding_pubkey_local" // 57
", shutdown_wrong_txid" // 58
", shutdown_wrong_outnum" // 59
", lease_expiry" // 60
", lease_commit_sig" // 61
", lease_chan_max_msat" // 62
", lease_chan_max_ppt" // 63
" FROM channels"
" WHERE state != ?;")); //? 0
db_bind_int(stmt, 0, CLOSED);
@ -1671,8 +1716,12 @@ void wallet_channel_save(struct wallet *w, struct channel *chan)
" closer=?," // 34
" state_change_reason=?," // 35
" shutdown_wrong_txid=?," // 36
" shutdown_wrong_outnum=?" // 37
" WHERE id=?")); // 38
" shutdown_wrong_outnum=?," // 37
" lease_expiry=?," // 38
" lease_commit_sig=?," // 39
" lease_chan_max_msat=?," // 40
" lease_chan_max_ppt=?" // 41
" WHERE id=?")); // 42
db_bind_u64(stmt, 0, chan->their_shachain.id);
if (chan->scid)
db_bind_short_channel_id(stmt, 1, chan->scid);
@ -1724,7 +1773,18 @@ void wallet_channel_save(struct wallet *w, struct channel *chan)
db_bind_null(stmt, 36);
db_bind_null(stmt, 37);
}
db_bind_u64(stmt, 38, chan->dbid);
db_bind_int(stmt, 38, chan->lease_expiry);
if (chan->lease_commit_sig) {
db_bind_signature(stmt, 39, chan->lease_commit_sig);
db_bind_int(stmt, 40, chan->lease_chan_max_msat);
db_bind_int(stmt, 41, chan->lease_chan_max_ppt);
} else {
db_bind_null(stmt, 39);
db_bind_null(stmt, 40);
db_bind_null(stmt, 41);
}
db_bind_u64(stmt, 42, chan->dbid);
db_exec_prepared_v2(take(stmt));
wallet_channel_config_save(w, &chan->channel_info.their_config);