Browse Source

dual-fund: don't kill dualopend after commitments exchanged

We're going to handle the funding tx sigs here, so we keep dualopend
open still, so we can get them in/out before moving on
ppa
niftynei 4 years ago
committed by Christian Decker
parent
commit
e0a7907d79
  1. 61
      lightningd/dual_open_control.c
  2. 234
      openingd/dualopend.c
  3. 4
      openingd/dualopend_wire.csv
  4. 18
      openingd/dualopend_wiregen.c
  5. 6
      openingd/dualopend_wiregen.h

61
lightningd/dual_open_control.c

@ -722,16 +722,15 @@ static void accepter_commit_received(struct subd *dualopend,
struct bitcoin_signature remote_commit_sig;
struct channel_id cid;
struct bitcoin_txid funding_txid;
struct per_peer_state *pps;
u16 funding_outnum;
u32 feerate;
struct amount_sat total_funding, funding_ours;
u8 channel_flags, *remote_upfront_shutdown_script,
*local_upfront_shutdown_script, *commitment_msg;
*local_upfront_shutdown_script;
struct penalty_base *pbase;
struct wally_psbt *psbt;
payload = tal(uc, struct openchannel2_psbt_payload);
payload = tal(dualopend, struct openchannel2_psbt_payload);
payload->rcvd = tal(payload, struct commit_rcvd);
/* This is a new channel_info.their_config so set its ID to 0 */
@ -744,7 +743,6 @@ static void accepter_commit_received(struct subd *dualopend,
&remote_commit_sig,
&psbt,
&cid,
&pps,
&channel_info.theirbase.revocation,
&channel_info.theirbase.payment,
&channel_info.theirbase.htlc,
@ -757,23 +755,20 @@ static void accepter_commit_received(struct subd *dualopend,
&funding_ours,
&channel_flags,
&feerate,
&commitment_msg,
&uc->our_config.channel_reserve,
&local_upfront_shutdown_script,
&remote_upfront_shutdown_script)) {
log_broken(uc->log, "bad WIRE_DUALOPEND_COMMIT_RCVD %s",
tal_hex(msg, msg));
uncommitted_channel_disconnect(uc, LOG_BROKEN, "bad WIRE_DUALOPEND_COMMIT_RCVD");
close(fds[0]);
close(fds[1]);
close(fds[3]);
uncommitted_channel_disconnect(uc, LOG_BROKEN, "bad"
" WIRE_DUALOPEND_COMMIT_RCVD");
goto failed;
}
per_peer_state_set_fds_arr(pps, fds);
payload->dualopend = dualopend;
tal_add_destructor2(dualopend, openchannel2_psbt_remove_dualopend,
payload);
payload->psbt = tal_steal(payload, psbt);
payload->rcvd->pps = tal_steal(payload, pps);
payload->rcvd->commitment_msg = tal_steal(payload, commitment_msg);
payload->ld = ld;
if (peer_active_channel(uc->peer)) {
@ -812,22 +807,19 @@ static void accepter_commit_received(struct subd *dualopend,
payload->rcvd->channel->dbid,
pbase);
/* dualopend is going away! */
/* We steal onto `NULL` because `payload` is tal'd off of `uc`;
* we free `uc` at the end though */
payload->rcvd->uc = tal_steal(NULL, uc);
subd_swap_channel(uc->open_daemon, payload->rcvd->channel,
channel_errmsg, channel_set_billboard);
payload->rcvd->channel->owner = dualopend;
/* We don't have a command, so set to NULL here */
payload->rcvd->channel->openchannel_signed_cmd = NULL;
uc->open_daemon = NULL;
tal_free(uc);
/* We call out to our hook friend who will provide signatures for us! */
plugin_hook_call_openchannel2_sign(ld, payload);
/* We release the things here; dualopend is going away ?? */
subd_release_channel(dualopend, uc);
uc->open_daemon = NULL;
return;
failed:
subd_release_channel(dualopend, uc);
uc->open_daemon = NULL;
tal_free(uc);
}
@ -842,13 +834,12 @@ static void opener_commit_received(struct subd *dualopend,
struct bitcoin_signature remote_commit_sig;
struct channel_id cid;
struct bitcoin_txid funding_txid;
struct per_peer_state *pps;
struct json_stream *response;
u16 funding_outnum;
u32 feerate;
struct amount_sat total_funding, funding_ours;
u8 channel_flags, *remote_upfront_shutdown_script,
*local_upfront_shutdown_script, *commitment_msg;
*local_upfront_shutdown_script;
struct penalty_base *pbase;
struct wally_psbt *psbt;
struct channel *channel;
@ -864,7 +855,6 @@ static void opener_commit_received(struct subd *dualopend,
&remote_commit_sig,
&psbt,
&cid,
&pps,
&channel_info.theirbase.revocation,
&channel_info.theirbase.payment,
&channel_info.theirbase.htlc,
@ -877,7 +867,6 @@ static void opener_commit_received(struct subd *dualopend,
&funding_ours,
&channel_flags,
&feerate,
&commitment_msg,
&uc->our_config.channel_reserve,
&local_upfront_shutdown_script,
&remote_upfront_shutdown_script)) {
@ -885,20 +874,12 @@ static void opener_commit_received(struct subd *dualopend,
tal_hex(msg, msg));
err_reason = "bad WIRE_DUALOPEND_COMMIT_RCVD";
uncommitted_channel_disconnect(uc, LOG_BROKEN, err_reason);
close(fds[0]);
close(fds[1]);
close(fds[3]);
goto failed;
}
/* We shouldn't have a commitment message, this is an
* accepter flow item */
assert(!commitment_msg);
/* old_remote_per_commit not valid yet, copy valid one. */
channel_info.old_remote_per_commit = channel_info.remote_per_commit;
per_peer_state_set_fds_arr(pps, fds);
if (peer_active_channel(uc->peer)) {
err_reason = "already have active channel";
uncommitted_channel_disconnect(uc, LOG_BROKEN, err_reason);
@ -944,17 +925,19 @@ static void opener_commit_received(struct subd *dualopend,
channel->psbt = tal_steal(channel, psbt);
wallet_channel_save(uc->fc->cmd->ld->wallet, channel);
peer_start_channeld(channel, pps,
NULL, false);
was_pending(command_success(uc->fc->cmd, response));
subd_swap_channel(uc->open_daemon, channel,
channel_errmsg, channel_set_billboard);
channel->owner = dualopend;
goto cleanup;
failed:
was_pending(command_fail(uc->fc->cmd, LIGHTNINGD,
"%s", err_reason));
cleanup:
subd_release_channel(dualopend, uc);
cleanup:
uc->open_daemon = NULL;
tal_free(uc);
}
@ -1493,8 +1476,6 @@ static unsigned int dual_opend_msg(struct subd *dualopend,
accepter_psbt_changed(dualopend, msg);
return 0;
case WIRE_DUALOPEND_COMMIT_RCVD:
if (tal_count(fds) != 3)
return 3;
if (uc->fc) {
if (!uc->fc->cmd) {
log_unusual(dualopend->log,

234
openingd/dualopend.c

@ -146,10 +146,10 @@ struct state {
bool funding_locked[NUM_SIDES];
/* PSBT of the funding tx */
struct wally_psbt *psbt;
};
#if EXPERIMENTAL_FEATURES
/* psbt_changeset_get_next - Get next message to send
*
* This generates the next message to send from a changeset for the
@ -1307,12 +1307,11 @@ static bool run_tx_interactive(struct state *state,
return true;
}
static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
static void accepter_start(struct state *state, const u8 *oc2_msg)
{
struct bitcoin_blkid chain_hash;
struct tlv_opening_tlvs *open_tlv;
u8 channel_flags;
struct wally_psbt *psbt;
char *err_reason;
const u8 *wscript;
struct channel_id cid;
@ -1373,7 +1372,7 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
type_to_string(tmpctx,
struct bitcoin_blkid,
&chain_hash));
return NULL;
return;
}
/* BOLT #2:
@ -1390,7 +1389,7 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
"opener's funding_satoshis %s too large",
type_to_string(tmpctx, struct amount_sat,
&state->opener_funding));
return NULL;
return;
}
/* We can figure out the channel id now */
@ -1424,17 +1423,17 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
u8 *errmsg = towire_errorfmt(tmpctx, &state->channel_id,
"%s", err_reason);
sync_crypto_write(state->pps, take(errmsg));
return NULL;
return;
}
if (!fromwire_dualopend_got_offer_reply(state, msg,
&state->accepter_funding,
&state->feerate_per_kw_funding,
&psbt,
&state->psbt,
&state->upfront_shutdown_script[LOCAL]))
master_badmsg(WIRE_DUALOPEND_GOT_OFFER_REPLY, msg);
if (!psbt)
psbt = create_psbt(state, 0, 0, state->tx_locktime);
if (!state->psbt)
state->psbt = create_psbt(state, 0, 0, state->tx_locktime);
/* Check that total funding doesn't overflow */
if (!amount_sat_add(&total, state->opener_funding,
@ -1462,11 +1461,11 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
"total funding_satoshis %s too large",
type_to_string(tmpctx, struct amount_sat,
&total));
return NULL;
return;
}
/* Add all of our inputs/outputs to the changeset */
init_changeset(state, psbt);
init_changeset(state, state->psbt);
/* Now that we know the total of the channel, we can set the reserve */
set_reserve(state, total);
@ -1481,7 +1480,7 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
true, /* v2 means we use anchor outputs */
&err_reason)) {
negotiation_failed(state, false, "%s", err_reason);
return NULL;
return;
}
/* If we have an upfront shutdown script, send it to our peer */
@ -1519,26 +1518,29 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
* to an invalid number, 1 (initiator sets; valid is even) */
state->funding_serial = 1;
/* Figure out what the funding transaction looks like! */
if (!run_tx_interactive(state, &psbt, TX_ACCEPTER))
return NULL;
if (!run_tx_interactive(state, &state->psbt, TX_ACCEPTER))
return;
/* Find the funding transaction txid */
psbt_txid(NULL, psbt, &state->funding_txid, NULL);
psbt_txid(NULL, state->psbt, &state->funding_txid, NULL);
wscript = bitcoin_redeem_2of2(state,
&state->our_funding_pubkey,
&state->their_funding_pubkey);
/* Figure out the txout */
if (!find_txout(psbt, scriptpubkey_p2wsh(tmpctx, wscript), &state->funding_txout))
if (!find_txout(state->psbt,
scriptpubkey_p2wsh(tmpctx, wscript),
&state->funding_txout))
peer_failed(state->pps, &state->channel_id,
"Expected output %s not found on funding tx %s",
tal_hex(tmpctx, scriptpubkey_p2wsh(tmpctx, wscript)),
type_to_string(tmpctx, struct wally_psbt, psbt));
type_to_string(tmpctx, struct wally_psbt,
state->psbt));
/* Check tx funds are sane */
err_reason = check_balances(tmpctx, state,
psbt,
state->psbt,
state->feerate_per_kw_funding);
if (err_reason)
negotiation_failed(state, false,
@ -1547,12 +1549,12 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
err_reason,
type_to_string(tmpctx,
struct wally_psbt,
psbt));
state->psbt));
/* Wait for the peer to send us our commitment tx signature */
msg = opening_negotiate_msg(tmpctx, state, false);
if (!msg)
return NULL;
return;
remote_sig.sighash_type = SIGHASH_ALL;
if (!fromwire_commitment_signed(tmpctx, msg, &cid,
@ -1602,7 +1604,7 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
negotiation_failed(state, false,
"Could not meet our fees and reserve: %s",
err_reason);
return NULL;
return;
}
/* BOLT #2:
@ -1641,7 +1643,7 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
type_to_string(tmpctx, struct bitcoin_txid,
&state->funding_txid),
type_to_string(tmpctx, struct wally_psbt,
psbt));
state->psbt));
}
/* Create commitment tx signatures for remote */
@ -1652,7 +1654,7 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
if (!remote_commit) {
negotiation_failed(state, false,
"Could not meet their fees and reserve: %s", err_reason);
return NULL;
return;
}
/* Make HSM sign it */
@ -1668,46 +1670,56 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
"Bad sign_tx_reply %s", tal_hex(tmpctx, msg));
assert(local_sig.sighash_type == SIGHASH_ALL);
msg = towire_commitment_signed(tmpctx, &state->channel_id,
&local_sig.s,
NULL);
if (direct_outputs[LOCAL])
pbase = penalty_base_new(tmpctx, 0, remote_commit,
direct_outputs[LOCAL]);
else
pbase = NULL;
/* Send the commitment_signed controller; will save to db
* and pass messages along to channeld to send along! */
return towire_dualopend_commit_rcvd(state,
&state->remoteconf,
remote_commit,
pbase,
&remote_sig,
psbt,
&state->channel_id,
state->pps,
&state->their_points.revocation,
&state->their_points.payment,
&state->their_points.htlc,
&state->their_points.delayed_payment,
&state->first_per_commitment_point[REMOTE],
&state->their_funding_pubkey,
&state->funding_txid,
state->funding_txout,
total,
state->accepter_funding,
channel_flags,
state->feerate_per_kw_commitment,
msg,
state->localconf.channel_reserve,
state->upfront_shutdown_script[LOCAL],
state->upfront_shutdown_script[REMOTE]);
/* Send the commitment_signed controller; will save to db,
* then wait to get our sigs back */
msg = towire_dualopend_commit_rcvd(state,
&state->remoteconf,
remote_commit,
pbase,
&remote_sig,
state->psbt,
&state->channel_id,
&state->their_points.revocation,
&state->their_points.payment,
&state->their_points.htlc,
&state->their_points.delayed_payment,
&state->first_per_commitment_point[REMOTE],
&state->their_funding_pubkey,
&state->funding_txid,
state->funding_txout,
total,
state->accepter_funding,
channel_flags,
state->feerate_per_kw_commitment,
state->localconf.channel_reserve,
state->upfront_shutdown_script[LOCAL],
state->upfront_shutdown_script[REMOTE]);
/* Normally we would end dualopend here (and in fact this
* is where openingd ends). However, now we wait for both our peer
* to send us the tx sigs *and* for master to send us the tx sigs. */
wire_sync_write(REQ_FD, take(msg));
msg = wire_sync_read(tmpctx, REQ_FD);
if (fromwire_peektype(msg) != WIRE_DUALOPEND_SEND_TX_SIGS)
master_badmsg(WIRE_DUALOPEND_SEND_TX_SIGS, msg);
/* Send our commitment sigs over now */
sync_crypto_write(state->pps,
take(towire_commitment_signed(NULL,
&state->channel_id,
&local_sig.s, NULL)));
/* Finally, send our funding tx sigs */
handle_send_tx_sigs(state, msg);
}
#endif /* EXPERIMENTAL_FEATURES */
static u8 *opener_start(struct state *state, u8 *msg)
static void opener_start(struct state *state, u8 *msg)
{
struct tlv_opening_tlvs *open_tlv;
struct tlv_accept_tlvs *a_tlv;
@ -1715,7 +1727,6 @@ static u8 *opener_start(struct state *state, u8 *msg)
char *err_reason;
struct amount_sat total;
struct amount_msat our_msats;
struct wally_psbt *psbt;
struct wally_psbt_output *funding_out;
struct sha256 podle;
struct wally_tx_output *direct_outputs[NUM_SIDES];
@ -1728,7 +1739,7 @@ static u8 *opener_start(struct state *state, u8 *msg)
u32 feerate_min, feerate_max, feerate_best;
if (!fromwire_dualopend_opener_init(state, msg,
&psbt,
&state->psbt,
&state->opener_funding,
&state->upfront_shutdown_script[LOCAL],
&state->feerate_per_kw_commitment,
@ -1737,7 +1748,7 @@ static u8 *opener_start(struct state *state, u8 *msg)
master_badmsg(WIRE_DUALOPEND_OPENER_INIT, msg);
state->our_role = TX_INITIATOR;
state->tx_locktime = psbt->tx->locktime;
state->tx_locktime = state->psbt->tx->locktime;
open_tlv = tlv_opening_tlvs_new(tmpctx);
feerate_min = state->min_feerate;
@ -1803,7 +1814,7 @@ static u8 *opener_start(struct state *state, u8 *msg)
/* ... since their reply should be immediate. */
msg = opening_negotiate_msg(tmpctx, state, true);
if (!msg)
return NULL;
return;
/* Set a cid default value, so on failure it's populated */
memset(&cid, 0xFF, sizeof(cid));
@ -1886,7 +1897,7 @@ static u8 *opener_start(struct state *state, u8 *msg)
"total funding_satoshis %s too large",
type_to_string(tmpctx, struct amount_sat,
&total));
return NULL;
return;
}
/* BOLT-78de9a79b491ae9fb84b1fdb4546bacf642dce87 #2:
@ -1898,16 +1909,19 @@ static u8 *opener_start(struct state *state, u8 *msg)
wscript = bitcoin_redeem_2of2(state,
&state->our_funding_pubkey,
&state->their_funding_pubkey);
funding_out = psbt_append_output(psbt,
funding_out = psbt_append_output(state->psbt,
scriptpubkey_p2wsh(tmpctx,
wscript),
total);
/* Add a serial_id for this output */
state->funding_serial = psbt_new_input_serial(psbt, TX_INITIATOR);
psbt_output_set_serial_id(psbt, funding_out, state->funding_serial);
state->funding_serial = psbt_new_input_serial(state->psbt,
TX_INITIATOR);
psbt_output_set_serial_id(state->psbt,
funding_out,
state->funding_serial);
/* Add all of our inputs/outputs to the changeset */
init_changeset(state, psbt);
init_changeset(state, state->psbt);
/* Now that we know the total of the channel, we can
* set the reserve */
@ -1922,31 +1936,31 @@ static u8 *opener_start(struct state *state, u8 *msg)
true, true, /* v2 means we use anchor outputs */
&err_reason)) {
negotiation_failed(state, false, "%s", err_reason);
return NULL;
return;
}
/* Send our first message, we're opener we initiate here */
if (!send_next(state, &psbt))
if (!send_next(state, &state->psbt))
negotiation_failed(state, true,
"Peer error, no updates to send");
/* Figure out what the funding transaction looks like! */
if (!run_tx_interactive(state, &psbt, TX_INITIATOR))
return NULL;
if (!run_tx_interactive(state, &state->psbt, TX_INITIATOR))
return;
psbt_txid(NULL, psbt, &state->funding_txid, NULL);
psbt_txid(NULL, state->psbt, &state->funding_txid, NULL);
/* Figure out the txout */
if (!find_txout(psbt, scriptpubkey_p2wsh(tmpctx, wscript),
if (!find_txout(state->psbt, scriptpubkey_p2wsh(tmpctx, wscript),
&state->funding_txout))
peer_failed(state->pps, &state->channel_id,
"Expected output %s not found on funding tx %s",
tal_hex(tmpctx, scriptpubkey_p2wsh(tmpctx, wscript)),
type_to_string(tmpctx, struct wally_psbt, psbt));
type_to_string(tmpctx, struct wally_psbt,
state->psbt));
/* Check tx funds are sane */
err_reason = check_balances(tmpctx, state,
psbt,
err_reason = check_balances(tmpctx, state, state->psbt,
state->feerate_per_kw_funding);
if (err_reason)
negotiation_failed(state, true,
@ -1955,7 +1969,7 @@ static u8 *opener_start(struct state *state, u8 *msg)
err_reason,
type_to_string(tmpctx,
struct wally_psbt,
psbt));
state->psbt));
if (!amount_sat_to_msat(&our_msats, state->opener_funding))
status_failed(STATUS_FAIL_INTERNAL_ERROR,
@ -1993,7 +2007,7 @@ static u8 *opener_start(struct state *state, u8 *msg)
negotiation_failed(state, true,
"Could not meet their fees and reserve: %s",
err_reason);
return NULL;
return;
}
@ -2031,7 +2045,7 @@ static u8 *opener_start(struct state *state, u8 *msg)
/* Wait for the peer to send us our commitment tx signature */
msg = opening_negotiate_msg(tmpctx, state, true);
if (!msg)
return NULL;
return;
remote_sig.sighash_type = SIGHASH_ALL;
if (!fromwire_commitment_signed(tmpctx, msg, &cid,
@ -2057,7 +2071,7 @@ static u8 *opener_start(struct state *state, u8 *msg)
negotiation_failed(state, false,
"Could not meet our fees and reserve: %s",
err_reason);
return NULL;
return;
}
/* BOLT #2:
@ -2096,7 +2110,7 @@ static u8 *opener_start(struct state *state, u8 *msg)
type_to_string(tmpctx, struct bitcoin_txid,
&state->funding_txid),
type_to_string(tmpctx, struct wally_psbt,
psbt));
state->psbt));
}
if (direct_outputs[LOCAL])
@ -2107,31 +2121,34 @@ static u8 *opener_start(struct state *state, u8 *msg)
peer_billboard(false, "channel open: commitment received, "
"sending to lightningd to save");
return towire_dualopend_commit_rcvd(state,
&state->remoteconf,
remote_commit,
pbase,
&remote_sig,
psbt,
&state->channel_id,
state->pps,
&state->their_points.revocation,
&state->their_points.payment,
&state->their_points.htlc,
&state->their_points.delayed_payment,
&state->first_per_commitment_point[REMOTE],
&state->their_funding_pubkey,
&state->funding_txid,
state->funding_txout,
total,
state->opener_funding,
channel_flags,
state->feerate_per_kw_commitment,
NULL,
state->localconf.channel_reserve,
state->upfront_shutdown_script[LOCAL],
state->upfront_shutdown_script[REMOTE]);
msg = towire_dualopend_commit_rcvd(NULL,
&state->remoteconf,
remote_commit,
pbase,
&remote_sig,
state->psbt,
&state->channel_id,
&state->their_points.revocation,
&state->their_points.payment,
&state->their_points.htlc,
&state->their_points.delayed_payment,
&state->first_per_commitment_point[REMOTE],
&state->their_funding_pubkey,
&state->funding_txid,
state->funding_txout,
total,
state->opener_funding,
channel_flags,
state->feerate_per_kw_commitment,
state->localconf.channel_reserve,
state->upfront_shutdown_script[LOCAL],
state->upfront_shutdown_script[REMOTE]);
/* Normally we would end dualopend here (and in fact this
* is where openingd ends). However, now we wait for both our peer
* to send us the tx sigs *and* for master to send us the tx sigs. */
wire_sync_write(REQ_FD, take(msg));
}
/*~ If we see the gossip_fd readable, we read a whole message. Sure, we might
@ -2187,9 +2204,11 @@ static u8 *handle_master_in(struct state *state)
#endif
return NULL;
case WIRE_DUALOPEND_OPENER_INIT:
return opener_start(state, msg);
opener_start(state, msg);
return NULL;
case WIRE_DUALOPEND_SEND_TX_SIGS:
return handle_send_tx_sigs(state, msg);
handle_send_tx_sigs(state, msg);
return NULL;
/* mostly handled inline */
case WIRE_DUALOPEND_INIT:
case WIRE_DUALOPEND_FUNDING_SIGS:
@ -2231,9 +2250,10 @@ static u8 *handle_peer_in(struct state *state)
enum peer_wire t = fromwire_peektype(msg);
struct channel_id channel_id;
if (t == WIRE_OPEN_CHANNEL2)
return accepter_start(state, msg);
if (t == WIRE_TX_SIGNATURES) {
if (t == WIRE_OPEN_CHANNEL2) {
accepter_start(state, msg);
return NULL;
} else if (t == WIRE_TX_SIGNATURES) {
handle_tx_sigs(state, msg);
return NULL;
}

4
openingd/dualopend_wire.csv

@ -64,7 +64,6 @@ msgdata,dualopend_commit_rcvd,pbase,?penalty_base,
msgdata,dualopend_commit_rcvd,first_commit_sig,bitcoin_signature,
msgdata,dualopend_commit_rcvd,psbt,wally_psbt,
msgdata,dualopend_commit_rcvd,channel_id,channel_id,
msgdata,dualopend_commit_rcvd,pps,per_peer_state,
msgdata,dualopend_commit_rcvd,revocation_basepoint,pubkey,
msgdata,dualopend_commit_rcvd,payment_basepoint,pubkey,
msgdata,dualopend_commit_rcvd,htlc_basepoint,pubkey,
@ -77,9 +76,6 @@ msgdata,dualopend_commit_rcvd,funding_satoshis,amount_sat,
msgdata,dualopend_commit_rcvd,our_funding_sats,amount_sat,
msgdata,dualopend_commit_rcvd,channel_flags,u8,
msgdata,dualopend_commit_rcvd,feerate_per_kw,u32,
# our commitment signatures, for the peer
msgdata,dualopend_commit_rcvd,msglen,u16,
msgdata,dualopend_commit_rcvd,commitment_msg,u8,msglen
msgdata,dualopend_commit_rcvd,our_channel_reserve_satoshis,amount_sat,
msgdata,dualopend_commit_rcvd,local_shutdown_len,u16,
msgdata,dualopend_commit_rcvd,local_shutdown_scriptpubkey,u8,local_shutdown_len

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

18
openingd/dualopend_wiregen.c

@ -223,9 +223,8 @@ bool fromwire_dualopend_got_offer_reply(const tal_t *ctx, const void *p, struct
/* 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 channel_id *channel_id, const struct per_peer_state *pps, 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, const u8 *commitment_msg, struct amount_sat our_channel_reserve_satoshis, 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 channel_id *channel_id, 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, struct amount_sat our_channel_reserve_satoshis, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey)
{
u16 msglen = tal_count(commitment_msg);
u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey);
u16 remote_shutdown_len = tal_count(remote_shutdown_scriptpubkey);
u8 *p = tal_arr(ctx, u8, 0);
@ -242,7 +241,6 @@ u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *
towire_bitcoin_signature(&p, first_commit_sig);
towire_wally_psbt(&p, psbt);
towire_channel_id(&p, channel_id);
towire_per_peer_state(&p, pps);
towire_pubkey(&p, revocation_basepoint);
towire_pubkey(&p, payment_basepoint);
towire_pubkey(&p, htlc_basepoint);
@ -255,9 +253,6 @@ u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *
towire_amount_sat(&p, our_funding_sats);
towire_u8(&p, channel_flags);
towire_u32(&p, feerate_per_kw);
/* our commitment signatures */
towire_u16(&p, msglen);
towire_u8_array(&p, commitment_msg, msglen);
towire_amount_sat(&p, our_channel_reserve_satoshis);
towire_u16(&p, local_shutdown_len);
towire_u8_array(&p, local_shutdown_scriptpubkey, local_shutdown_len);
@ -266,9 +261,8 @@ u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *
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 channel_id *channel_id, struct per_peer_state **pps, 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, u8 **commitment_msg, struct amount_sat *our_channel_reserve_satoshis, 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 channel_id *channel_id, 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, struct amount_sat *our_channel_reserve_satoshis, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey)
{
u16 msglen;
u16 local_shutdown_len;
u16 remote_shutdown_len;
@ -288,7 +282,6 @@ bool fromwire_dualopend_commit_rcvd(const tal_t *ctx, const void *p, struct chan
fromwire_bitcoin_signature(&cursor, &plen, first_commit_sig);
*psbt = fromwire_wally_psbt(ctx, &cursor, &plen);
fromwire_channel_id(&cursor, &plen, channel_id);
*pps = fromwire_per_peer_state(ctx, &cursor, &plen);
fromwire_pubkey(&cursor, &plen, revocation_basepoint);
fromwire_pubkey(&cursor, &plen, payment_basepoint);
fromwire_pubkey(&cursor, &plen, htlc_basepoint);
@ -301,11 +294,6 @@ bool fromwire_dualopend_commit_rcvd(const tal_t *ctx, const void *p, struct chan
*our_funding_sats = fromwire_amount_sat(&cursor, &plen);
*channel_flags = fromwire_u8(&cursor, &plen);
*feerate_per_kw = fromwire_u32(&cursor, &plen);
/* our commitment signatures */
msglen = fromwire_u16(&cursor, &plen);
// 2nd case commitment_msg
*commitment_msg = msglen ? tal_arr(ctx, u8, msglen) : NULL;
fromwire_u8_array(&cursor, &plen, *commitment_msg, msglen);
*our_channel_reserve_satoshis = fromwire_amount_sat(&cursor, &plen);
local_shutdown_len = fromwire_u16(&cursor, &plen);
// 2nd case local_shutdown_scriptpubkey
@ -533,4 +521,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak)
*leak = fromwire_bool(&cursor, &plen);
return cursor != NULL;
}
// SHA256STAMP:b050a7cf375aa2cfbc25f86556d06acaa7f1ed96170adaa912e5ba994a2879c2
// SHA256STAMP:b209a8683f1e9cbdc9f64302b70b86b2d66ac8fa917e3f1e482fda64f92c20a2

6
openingd/dualopend_wiregen.h

@ -74,8 +74,8 @@ bool fromwire_dualopend_got_offer_reply(const tal_t *ctx, const void *p, struct
/* 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 channel_id *channel_id, const struct per_peer_state *pps, 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, const u8 *commitment_msg, struct amount_sat our_channel_reserve_satoshis, 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 channel_id *channel_id, struct per_peer_state **pps, 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, u8 **commitment_msg, struct amount_sat *our_channel_reserve_satoshis, 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 channel_id *channel_id, 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, struct amount_sat our_channel_reserve_satoshis, 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 channel_id *channel_id, 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, struct amount_sat *our_channel_reserve_satoshis, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey);
/* WIRE: DUALOPEND_PSBT_CHANGED */
/* dualopend->master: peer updated the psbt */
@ -123,4 +123,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak);
#endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */
// SHA256STAMP:b050a7cf375aa2cfbc25f86556d06acaa7f1ed96170adaa912e5ba994a2879c2
// SHA256STAMP:b209a8683f1e9cbdc9f64302b70b86b2d66ac8fa917e3f1e482fda64f92c20a2

Loading…
Cancel
Save