mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
df: consolidate callbacks for opener/accepter, move to open_attempt
This commit is contained in:
parent
bfb862564e
commit
628f9df320
@ -41,12 +41,7 @@ struct commit_rcvd {
|
|||||||
struct uncommitted_channel *uc;
|
struct uncommitted_channel *uc;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* FIXME: remove when used */
|
static void
|
||||||
void
|
|
||||||
unsaved_channel_disconnect(struct channel *channel,
|
|
||||||
enum log_level level,
|
|
||||||
const char *desc);
|
|
||||||
void
|
|
||||||
unsaved_channel_disconnect(struct channel *channel,
|
unsaved_channel_disconnect(struct channel *channel,
|
||||||
enum log_level level,
|
enum log_level level,
|
||||||
const char *desc)
|
const char *desc)
|
||||||
@ -871,104 +866,101 @@ REGISTER_PLUGIN_HOOK(rbf_channel,
|
|||||||
|
|
||||||
/* Steals fields from uncommitted_channel: returns NULL if can't generate a
|
/* Steals fields from uncommitted_channel: returns NULL if can't generate a
|
||||||
* key for this channel (shouldn't happen!). */
|
* key for this channel (shouldn't happen!). */
|
||||||
static struct channel *
|
static struct channel_inflight *
|
||||||
wallet_commit_channel(struct lightningd *ld,
|
wallet_commit_channel(struct lightningd *ld,
|
||||||
struct uncommitted_channel *uc,
|
struct channel *channel,
|
||||||
struct channel_id *cid,
|
|
||||||
struct bitcoin_tx *remote_commit,
|
struct bitcoin_tx *remote_commit,
|
||||||
struct bitcoin_signature *remote_commit_sig,
|
struct bitcoin_signature *remote_commit_sig,
|
||||||
const struct bitcoin_txid *funding_txid,
|
const struct bitcoin_txid *funding_txid,
|
||||||
u16 funding_outnum,
|
u16 funding_outnum,
|
||||||
struct amount_sat total_funding,
|
struct amount_sat total_funding,
|
||||||
struct amount_sat our_funding,
|
struct amount_sat our_funding,
|
||||||
u8 channel_flags,
|
struct channel_info *channel_info,
|
||||||
const struct channel_info *channel_info,
|
u32 commitment_feerate,
|
||||||
u32 feerate,
|
u32 funding_feerate,
|
||||||
enum side opener,
|
|
||||||
const u8 *our_upfront_shutdown_script,
|
const u8 *our_upfront_shutdown_script,
|
||||||
const u8 *remote_upfront_shutdown_script)
|
const u8 *remote_upfront_shutdown_script,
|
||||||
|
struct wally_psbt *psbt STEALS)
|
||||||
{
|
{
|
||||||
struct channel *channel;
|
|
||||||
s64 final_key_idx;
|
|
||||||
bool option_static_remotekey;
|
|
||||||
bool option_anchor_outputs;
|
|
||||||
struct amount_msat our_msat;
|
struct amount_msat our_msat;
|
||||||
|
struct channel_inflight *inflight;
|
||||||
/* Get a key to use for closing outputs from this tx */
|
|
||||||
final_key_idx = wallet_get_newindex(ld);
|
|
||||||
if (final_key_idx == -1) {
|
|
||||||
log_broken(uc->log, "Can't get final key index");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!amount_sat_to_msat(&our_msat, our_funding)) {
|
if (!amount_sat_to_msat(&our_msat, our_funding)) {
|
||||||
log_broken(uc->log, "Unable to convert funds");
|
log_broken(channel->log, "Unable to convert funds");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BOLT-7b04b1461739c5036add61782d58ac490842d98b #9
|
/* Get a key to use for closing outputs from this tx */
|
||||||
* | 222/223 | `option_dual_fund`
|
channel->final_key_idx = wallet_get_newindex(ld);
|
||||||
* | Use v2 of channel open, enables dual funding
|
if (channel->final_key_idx == -1) {
|
||||||
* | IN9
|
log_broken(channel->log, "Can't get final key index");
|
||||||
* | `option_anchor_outputs` */
|
return NULL;
|
||||||
option_static_remotekey = true;
|
}
|
||||||
option_anchor_outputs = true;
|
|
||||||
|
|
||||||
channel = new_channel(uc->peer, uc->dbid,
|
/* This is a new channel_info.their_config so set its ID to 0 */
|
||||||
NULL, /* No shachain yet */
|
channel_info->their_config.id = 0;
|
||||||
DUALOPEND_OPEN_INIT,
|
/* old_remote_per_commit not valid yet, copy valid one. */
|
||||||
opener,
|
channel_info->old_remote_per_commit = channel_info->remote_per_commit;
|
||||||
uc->log,
|
|
||||||
take(uc->transient_billboard),
|
/* Promote the unsaved_dbid to the dbid */
|
||||||
channel_flags,
|
assert(channel->unsaved_dbid != 0);
|
||||||
&uc->our_config,
|
channel->dbid = channel->unsaved_dbid;
|
||||||
uc->minimum_depth,
|
channel->unsaved_dbid = 0;
|
||||||
1, 1, 0,
|
|
||||||
funding_txid,
|
channel->funding_txid = *funding_txid;
|
||||||
funding_outnum,
|
channel->funding_outnum = funding_outnum;
|
||||||
total_funding,
|
channel->funding = total_funding;
|
||||||
AMOUNT_MSAT(0),
|
channel->our_funds = our_funding;
|
||||||
our_funding,
|
channel->our_msat = our_msat;
|
||||||
false, /* !remote_funding_locked */
|
channel->msat_to_us_min = our_msat;
|
||||||
false, /* !remote_tx_sigs */
|
channel->msat_to_us_max = our_msat;
|
||||||
NULL, /* no scid yet */
|
channel->last_tx = tal_steal(channel, remote_commit);
|
||||||
/* The three arguments below are msatoshi_to_us,
|
channel->last_sig = *remote_commit_sig;
|
||||||
* msatoshi_to_us_min, and msatoshi_to_us_max.
|
channel->channel_info = *channel_info;
|
||||||
* Because, this is a newly-funded channel,
|
channel->fee_states = new_fee_states(channel,
|
||||||
* all three are same value. */
|
channel->opener,
|
||||||
our_msat,
|
&commitment_feerate);
|
||||||
our_msat, /* msat_to_us_min */
|
channel->min_possible_feerate = commitment_feerate;
|
||||||
our_msat, /* msat_to_us_max */
|
channel->max_possible_feerate = commitment_feerate;
|
||||||
remote_commit,
|
|
||||||
remote_commit_sig,
|
/* We are connected */
|
||||||
NULL, /* No HTLC sigs yet */
|
channel->connected = true;
|
||||||
channel_info,
|
|
||||||
take(new_fee_states(NULL, opener, &feerate)),
|
if (our_upfront_shutdown_script)
|
||||||
NULL, /* No shutdown_scriptpubkey[REMOTE] yet */
|
channel->shutdown_scriptpubkey[LOCAL]
|
||||||
our_upfront_shutdown_script,
|
= tal_steal(channel, our_upfront_shutdown_script);
|
||||||
final_key_idx, false,
|
else
|
||||||
NULL, /* No commit sent yet */
|
channel->shutdown_scriptpubkey[LOCAL]
|
||||||
/* If we're fundee, could be a little before this
|
= p2wpkh_for_keyidx(channel, channel->peer->ld,
|
||||||
* in theory, but it's only used for timing out. */
|
channel->final_key_idx);
|
||||||
get_block_height(ld->topology),
|
|
||||||
feerate, feerate,
|
channel->remote_upfront_shutdown_script
|
||||||
/* We are connected */
|
= tal_steal(channel, remote_upfront_shutdown_script);
|
||||||
true,
|
|
||||||
&uc->local_basepoints,
|
channel->state_change_cause = (channel->opener == LOCAL) ?
|
||||||
&uc->local_funding_pubkey,
|
REASON_USER : REASON_REMOTE;
|
||||||
NULL,
|
|
||||||
ld->config.fee_base,
|
/* If we're fundee, could be a little before this
|
||||||
ld->config.fee_per_satoshi,
|
* in theory, but it's only used for timing out. */
|
||||||
remote_upfront_shutdown_script,
|
channel->first_blocknum = get_block_height(ld->topology);
|
||||||
option_static_remotekey,
|
|
||||||
option_anchor_outputs,
|
|
||||||
NUM_SIDES, /* closer not yet known */
|
|
||||||
opener == LOCAL ? REASON_USER : REASON_REMOTE);
|
|
||||||
|
|
||||||
/* Now we finally put it in the database. */
|
/* Now we finally put it in the database. */
|
||||||
wallet_channel_insert(ld->wallet, channel);
|
wallet_channel_insert(ld->wallet, channel);
|
||||||
|
|
||||||
return channel;
|
/* Open attempt to channel's inflights */
|
||||||
|
inflight = new_inflight(channel,
|
||||||
|
channel->funding_txid,
|
||||||
|
channel->funding_outnum,
|
||||||
|
funding_feerate,
|
||||||
|
channel->funding,
|
||||||
|
channel->our_funds,
|
||||||
|
psbt,
|
||||||
|
channel->last_tx,
|
||||||
|
channel->last_sig);
|
||||||
|
wallet_inflight_add(ld->wallet, inflight);
|
||||||
|
channel->open_attempt = NULL;
|
||||||
|
|
||||||
|
return inflight;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_peer_wants_to_close(struct subd *dualopend,
|
static void handle_peer_wants_to_close(struct subd *dualopend,
|
||||||
@ -1071,271 +1063,6 @@ static void handle_channel_closed(struct subd *dualopend,
|
|||||||
"Start closingd");
|
"Start closingd");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void opener_psbt_changed(struct subd *dualopend,
|
|
||||||
struct uncommitted_channel *uc,
|
|
||||||
const u8 *msg)
|
|
||||||
{
|
|
||||||
struct channel_id cid;
|
|
||||||
u64 funding_serial;
|
|
||||||
struct wally_psbt *psbt;
|
|
||||||
struct json_stream *response;
|
|
||||||
struct command *cmd = uc->fc->cmd;
|
|
||||||
|
|
||||||
if (!fromwire_dualopend_psbt_changed(cmd, msg,
|
|
||||||
&cid, &funding_serial,
|
|
||||||
&psbt)) {
|
|
||||||
log_broken(dualopend->log,
|
|
||||||
"Malformed dual_open_psbt_changed %s",
|
|
||||||
tal_hex(tmpctx, msg));
|
|
||||||
tal_free(dualopend);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
response = json_stream_success(cmd);
|
|
||||||
json_add_string(response, "channel_id",
|
|
||||||
type_to_string(tmpctx, struct channel_id, &cid));
|
|
||||||
json_add_psbt(response, "psbt", psbt);
|
|
||||||
json_add_bool(response, "commitments_secured", false);
|
|
||||||
json_add_u64(response, "funding_serial", funding_serial);
|
|
||||||
|
|
||||||
uc->cid = cid;
|
|
||||||
uc->fc->inflight = true;
|
|
||||||
uc->fc->cmd = NULL;
|
|
||||||
was_pending(command_success(cmd, response));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void accepter_commit_received(struct subd *dualopend,
|
|
||||||
struct uncommitted_channel *uc,
|
|
||||||
const int *fds,
|
|
||||||
const u8 *msg)
|
|
||||||
{
|
|
||||||
struct openchannel2_psbt_payload *payload;
|
|
||||||
|
|
||||||
struct lightningd *ld = dualopend->ld;
|
|
||||||
struct channel_info channel_info;
|
|
||||||
struct bitcoin_tx *remote_commit;
|
|
||||||
struct bitcoin_signature remote_commit_sig;
|
|
||||||
struct channel_id cid;
|
|
||||||
struct bitcoin_txid funding_txid;
|
|
||||||
u16 funding_outnum;
|
|
||||||
u32 feerate;
|
|
||||||
struct amount_sat total_funding, funding_ours;
|
|
||||||
u8 channel_flags, *remote_upfront_shutdown_script,
|
|
||||||
*local_upfront_shutdown_script;
|
|
||||||
struct penalty_base *pbase;
|
|
||||||
struct wally_psbt *psbt;
|
|
||||||
|
|
||||||
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 */
|
|
||||||
channel_info.their_config.id = 0;
|
|
||||||
|
|
||||||
if (!fromwire_dualopend_commit_rcvd(tmpctx, msg,
|
|
||||||
&channel_info.their_config,
|
|
||||||
&remote_commit,
|
|
||||||
&pbase,
|
|
||||||
&remote_commit_sig,
|
|
||||||
&psbt,
|
|
||||||
&cid,
|
|
||||||
&channel_info.theirbase.revocation,
|
|
||||||
&channel_info.theirbase.payment,
|
|
||||||
&channel_info.theirbase.htlc,
|
|
||||||
&channel_info.theirbase.delayed_payment,
|
|
||||||
&channel_info.remote_per_commit,
|
|
||||||
&channel_info.remote_fundingkey,
|
|
||||||
&funding_txid,
|
|
||||||
&funding_outnum,
|
|
||||||
&total_funding,
|
|
||||||
&funding_ours,
|
|
||||||
&channel_flags,
|
|
||||||
&feerate,
|
|
||||||
&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");
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
payload->dualopend = dualopend;
|
|
||||||
tal_add_destructor2(dualopend, openchannel2_psbt_remove_dualopend,
|
|
||||||
payload);
|
|
||||||
payload->psbt = tal_steal(payload, psbt);
|
|
||||||
payload->ld = ld;
|
|
||||||
|
|
||||||
if (peer_active_channel(uc->peer)) {
|
|
||||||
uncommitted_channel_disconnect(uc, LOG_BROKEN,
|
|
||||||
"already have active channel");
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* old_remote_per_commit not valid yet, copy valid one. */
|
|
||||||
channel_info.old_remote_per_commit = channel_info.remote_per_commit;
|
|
||||||
|
|
||||||
payload->rcvd->channel =
|
|
||||||
wallet_commit_channel(ld, uc,
|
|
||||||
&cid,
|
|
||||||
remote_commit,
|
|
||||||
&remote_commit_sig,
|
|
||||||
&funding_txid,
|
|
||||||
funding_outnum,
|
|
||||||
total_funding,
|
|
||||||
funding_ours,
|
|
||||||
channel_flags,
|
|
||||||
&channel_info,
|
|
||||||
feerate,
|
|
||||||
REMOTE,
|
|
||||||
local_upfront_shutdown_script,
|
|
||||||
remote_upfront_shutdown_script);
|
|
||||||
|
|
||||||
if (!payload->rcvd->channel) {
|
|
||||||
uncommitted_channel_disconnect(uc, LOG_BROKEN,
|
|
||||||
"commit channel failed");
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pbase)
|
|
||||||
wallet_penalty_base_add(ld->wallet,
|
|
||||||
payload->rcvd->channel->dbid,
|
|
||||||
pbase);
|
|
||||||
|
|
||||||
subd_swap_channel(uc->open_daemon, payload->rcvd->channel, 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);
|
|
||||||
return;
|
|
||||||
|
|
||||||
failed:
|
|
||||||
tal_free(uc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void opener_commit_received(struct subd *dualopend,
|
|
||||||
struct uncommitted_channel *uc,
|
|
||||||
const int *fds,
|
|
||||||
const u8 *msg)
|
|
||||||
{
|
|
||||||
struct lightningd *ld = dualopend->ld;
|
|
||||||
struct channel_info channel_info;
|
|
||||||
struct bitcoin_tx *remote_commit;
|
|
||||||
struct bitcoin_signature remote_commit_sig;
|
|
||||||
struct channel_id cid;
|
|
||||||
struct bitcoin_txid funding_txid;
|
|
||||||
struct json_stream *response;
|
|
||||||
u16 funding_outnum;
|
|
||||||
u32 feerate;
|
|
||||||
struct amount_sat total_funding, funding_ours;
|
|
||||||
u8 channel_flags, *remote_upfront_shutdown_script,
|
|
||||||
*unused_script;
|
|
||||||
struct penalty_base *pbase;
|
|
||||||
struct wally_psbt *psbt;
|
|
||||||
struct channel *channel;
|
|
||||||
char *err_reason;
|
|
||||||
|
|
||||||
/* This is a new channel_info.their_config so set its ID to 0 */
|
|
||||||
channel_info.their_config.id = 0;
|
|
||||||
|
|
||||||
if (!fromwire_dualopend_commit_rcvd(tmpctx, msg,
|
|
||||||
&channel_info.their_config,
|
|
||||||
&remote_commit,
|
|
||||||
&pbase,
|
|
||||||
&remote_commit_sig,
|
|
||||||
&psbt,
|
|
||||||
&cid,
|
|
||||||
&channel_info.theirbase.revocation,
|
|
||||||
&channel_info.theirbase.payment,
|
|
||||||
&channel_info.theirbase.htlc,
|
|
||||||
&channel_info.theirbase.delayed_payment,
|
|
||||||
&channel_info.remote_per_commit,
|
|
||||||
&channel_info.remote_fundingkey,
|
|
||||||
&funding_txid,
|
|
||||||
&funding_outnum,
|
|
||||||
&total_funding,
|
|
||||||
&funding_ours,
|
|
||||||
&channel_flags,
|
|
||||||
&feerate,
|
|
||||||
&uc->our_config.channel_reserve,
|
|
||||||
&unused_script,
|
|
||||||
&remote_upfront_shutdown_script)) {
|
|
||||||
log_broken(uc->log, "bad WIRE_DUALOPEND_COMMIT_RCVD %s",
|
|
||||||
tal_hex(msg, msg));
|
|
||||||
err_reason = "bad WIRE_DUALOPEND_COMMIT_RCVD";
|
|
||||||
uncommitted_channel_disconnect(uc, LOG_BROKEN, err_reason);
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* old_remote_per_commit not valid yet, copy valid one. */
|
|
||||||
channel_info.old_remote_per_commit = channel_info.remote_per_commit;
|
|
||||||
|
|
||||||
if (peer_active_channel(uc->peer)) {
|
|
||||||
err_reason = "already have active channel";
|
|
||||||
uncommitted_channel_disconnect(uc, LOG_BROKEN, err_reason);
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Our end game is to save the channel to the database, and return the
|
|
||||||
* command with 'commitments_secured' set to true */
|
|
||||||
channel = wallet_commit_channel(ld, uc, &cid,
|
|
||||||
remote_commit,
|
|
||||||
&remote_commit_sig,
|
|
||||||
&funding_txid,
|
|
||||||
funding_outnum,
|
|
||||||
total_funding,
|
|
||||||
funding_ours,
|
|
||||||
channel_flags,
|
|
||||||
&channel_info,
|
|
||||||
feerate,
|
|
||||||
LOCAL,
|
|
||||||
uc->fc->our_upfront_shutdown_script,
|
|
||||||
remote_upfront_shutdown_script);
|
|
||||||
|
|
||||||
if (!channel) {
|
|
||||||
err_reason = "commit channel failed";
|
|
||||||
uncommitted_channel_disconnect(uc, LOG_BROKEN, err_reason);
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pbase)
|
|
||||||
wallet_penalty_base_add(ld->wallet, channel->dbid, pbase);
|
|
||||||
|
|
||||||
response = json_stream_success(uc->fc->cmd);
|
|
||||||
json_add_string(response, "channel_id",
|
|
||||||
type_to_string(tmpctx, struct channel_id, &cid));
|
|
||||||
json_add_psbt(response, "psbt", psbt);
|
|
||||||
json_add_bool(response, "commitments_secured", true);
|
|
||||||
/* For convenience sake, we include the funding outnum */
|
|
||||||
json_add_num(response, "funding_outnum", funding_outnum);
|
|
||||||
if (uc->fc->our_upfront_shutdown_script)
|
|
||||||
json_add_hex_talarr(response, "close_to",
|
|
||||||
uc->fc->our_upfront_shutdown_script);
|
|
||||||
/* Now that we've got the final PSBT, save it */
|
|
||||||
// FIXME: update channel->psbt
|
|
||||||
|
|
||||||
was_pending(command_success(uc->fc->cmd, response));
|
|
||||||
|
|
||||||
subd_swap_channel(uc->open_daemon, channel, CHANNEL,
|
|
||||||
channel_errmsg, channel_set_billboard);
|
|
||||||
channel->owner = dualopend;
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
failed:
|
|
||||||
was_pending(command_fail(uc->fc->cmd, LIGHTNINGD,
|
|
||||||
"%s", err_reason));
|
|
||||||
subd_release_channel(dualopend, uc);
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
uc->open_daemon = NULL;
|
|
||||||
tal_free(uc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
opening_failed_cancel_commands(struct channel *channel,
|
opening_failed_cancel_commands(struct channel *channel,
|
||||||
struct open_attempt *oa,
|
struct open_attempt *oa,
|
||||||
@ -1637,30 +1364,6 @@ void dualopen_tell_depth(struct subd *dualopend,
|
|||||||
to_go));
|
to_go));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void accepter_psbt_changed(struct subd *dualopend,
|
|
||||||
const u8 *msg)
|
|
||||||
{
|
|
||||||
u64 unused;
|
|
||||||
struct openchannel2_psbt_payload *payload =
|
|
||||||
tal(dualopend, struct openchannel2_psbt_payload);
|
|
||||||
payload->dualopend = dualopend;
|
|
||||||
payload->psbt = NULL;
|
|
||||||
payload->rcvd = tal(payload, struct commit_rcvd);
|
|
||||||
|
|
||||||
if (!fromwire_dualopend_psbt_changed(payload, msg,
|
|
||||||
&payload->rcvd->cid,
|
|
||||||
&unused,
|
|
||||||
&payload->psbt)) {
|
|
||||||
log_broken(dualopend->log, "Malformed dual_open_psbt_changed %s",
|
|
||||||
tal_hex(tmpctx, msg));
|
|
||||||
tal_free(dualopend);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tal_add_destructor2(dualopend, openchannel2_psbt_remove_dualopend, payload);
|
|
||||||
plugin_hook_call_openchannel2_changed(dualopend->ld, payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void rbf_got_offer(struct subd *dualopend, const u8 *msg)
|
static void rbf_got_offer(struct subd *dualopend, const u8 *msg)
|
||||||
{
|
{
|
||||||
/* We expect the channel to still exist?! */
|
/* We expect the channel to still exist?! */
|
||||||
@ -2226,13 +1929,220 @@ channel_fail_fallen_behind(struct subd* dualopend, const u8 *msg)
|
|||||||
channel_fallen_behind(channel, msg);
|
channel_fallen_behind(channel, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_psbt_changed(struct subd *dualopend,
|
||||||
|
struct channel *channel,
|
||||||
|
const u8 *msg)
|
||||||
|
{
|
||||||
|
struct channel_id cid;
|
||||||
|
u64 funding_serial;
|
||||||
|
struct wally_psbt *psbt;
|
||||||
|
struct json_stream *response;
|
||||||
|
struct openchannel2_psbt_payload *payload;
|
||||||
|
struct open_attempt *oa;
|
||||||
|
struct command *cmd;
|
||||||
|
|
||||||
|
assert(channel->open_attempt);
|
||||||
|
oa = channel->open_attempt;
|
||||||
|
cmd = oa->cmd;
|
||||||
|
|
||||||
|
if (!fromwire_dualopend_psbt_changed(tmpctx, msg,
|
||||||
|
&cid,
|
||||||
|
&funding_serial,
|
||||||
|
&psbt)) {
|
||||||
|
log_broken(dualopend->log,
|
||||||
|
"Malformed dual_open_psbt_changed %s",
|
||||||
|
tal_hex(tmpctx, msg));
|
||||||
|
tal_free(dualopend);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
switch (oa->role) {
|
||||||
|
case TX_INITIATOR:
|
||||||
|
if (!cmd) {
|
||||||
|
/* FIXME: handling for post-inflight errors */
|
||||||
|
unsaved_channel_disconnect(channel, LOG_UNUSUAL,
|
||||||
|
tal_fmt(tmpctx,
|
||||||
|
"Unexpected PSBT"
|
||||||
|
"_CHANGED %s",
|
||||||
|
tal_hex(tmpctx,
|
||||||
|
msg)));
|
||||||
|
if (list_empty(&channel->inflights)) {
|
||||||
|
subd_release_channel(dualopend, channel);
|
||||||
|
tal_free(dualopend);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* This might be the first time we learn the channel_id */
|
||||||
|
channel->cid = cid;
|
||||||
|
response = json_stream_success(cmd);
|
||||||
|
json_add_string(response, "channel_id",
|
||||||
|
type_to_string(tmpctx, struct channel_id,
|
||||||
|
&channel->cid));
|
||||||
|
json_add_psbt(response, "psbt", psbt);
|
||||||
|
json_add_bool(response, "commitments_secured", false);
|
||||||
|
json_add_u64(response, "funding_serial", funding_serial);
|
||||||
|
|
||||||
|
oa->cmd = NULL;
|
||||||
|
was_pending(command_success(cmd, response));
|
||||||
|
return;
|
||||||
|
case TX_ACCEPTER:
|
||||||
|
payload = tal(dualopend, struct openchannel2_psbt_payload);
|
||||||
|
payload->dualopend = dualopend;
|
||||||
|
tal_add_destructor2(dualopend,
|
||||||
|
openchannel2_psbt_remove_dualopend,
|
||||||
|
payload);
|
||||||
|
payload->psbt = tal_steal(payload, psbt);
|
||||||
|
// FIXME: payload->channel = channel;
|
||||||
|
plugin_hook_call_openchannel2_changed(dualopend->ld, payload);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handle_commit_received(struct subd *dualopend,
|
||||||
|
struct channel *channel,
|
||||||
|
const u8 *msg)
|
||||||
|
{
|
||||||
|
struct lightningd *ld = dualopend->ld;
|
||||||
|
struct open_attempt *oa = channel->open_attempt;
|
||||||
|
struct channel_info channel_info;
|
||||||
|
struct bitcoin_tx *remote_commit;
|
||||||
|
struct bitcoin_signature remote_commit_sig;
|
||||||
|
struct bitcoin_txid funding_txid;
|
||||||
|
u16 funding_outnum;
|
||||||
|
u32 feerate_funding, feerate_commitment = 0;
|
||||||
|
struct amount_sat total_funding, funding_ours;
|
||||||
|
u8 *remote_upfront_shutdown_script,
|
||||||
|
*local_upfront_shutdown_script;
|
||||||
|
struct penalty_base *pbase;
|
||||||
|
struct wally_psbt *psbt;
|
||||||
|
struct json_stream *response;
|
||||||
|
struct openchannel2_psbt_payload *payload;
|
||||||
|
struct channel_inflight *inflight;
|
||||||
|
char *err_reason;
|
||||||
|
struct command *cmd = oa->cmd;
|
||||||
|
|
||||||
|
/* We clean up the open attempt regardless */
|
||||||
|
tal_steal(tmpctx, oa);
|
||||||
|
|
||||||
|
if (!fromwire_dualopend_commit_rcvd(tmpctx, msg,
|
||||||
|
&channel_info.their_config,
|
||||||
|
&remote_commit,
|
||||||
|
&pbase,
|
||||||
|
&remote_commit_sig,
|
||||||
|
&psbt,
|
||||||
|
&channel_info.theirbase.revocation,
|
||||||
|
&channel_info.theirbase.payment,
|
||||||
|
&channel_info.theirbase.htlc,
|
||||||
|
&channel_info.theirbase.delayed_payment,
|
||||||
|
&channel_info.remote_per_commit,
|
||||||
|
&channel_info.remote_fundingkey,
|
||||||
|
&funding_txid,
|
||||||
|
&funding_outnum,
|
||||||
|
&total_funding,
|
||||||
|
&funding_ours,
|
||||||
|
&channel->channel_flags,
|
||||||
|
&feerate_funding,
|
||||||
|
&channel->our_config.channel_reserve,
|
||||||
|
&local_upfront_shutdown_script,
|
||||||
|
&remote_upfront_shutdown_script)) {
|
||||||
|
log_broken(channel->log, "bad WIRE_DUALOPEND_COMMIT_RCVD %s",
|
||||||
|
tal_hex(msg, msg));
|
||||||
|
err_reason = "bad WIRE_DUALOPEND_COMMIT_RCVD";
|
||||||
|
unsaved_channel_disconnect(channel, LOG_BROKEN, err_reason);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (peer_active_channel(channel->peer)) {
|
||||||
|
err_reason = "already have active channel";
|
||||||
|
unsaved_channel_disconnect(channel, LOG_BROKEN, err_reason);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(inflight = wallet_commit_channel(ld, channel,
|
||||||
|
remote_commit,
|
||||||
|
&remote_commit_sig,
|
||||||
|
&funding_txid,
|
||||||
|
funding_outnum,
|
||||||
|
total_funding,
|
||||||
|
funding_ours,
|
||||||
|
&channel_info,
|
||||||
|
feerate_funding,
|
||||||
|
feerate_commitment,
|
||||||
|
oa->role == TX_INITIATOR ?
|
||||||
|
oa->our_upfront_shutdown_script :
|
||||||
|
local_upfront_shutdown_script,
|
||||||
|
remote_upfront_shutdown_script,
|
||||||
|
psbt))) {
|
||||||
|
err_reason = "commit channel failed";
|
||||||
|
unsaved_channel_disconnect(channel, LOG_BROKEN, err_reason);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pbase)
|
||||||
|
wallet_penalty_base_add(ld->wallet, channel->dbid, pbase);
|
||||||
|
|
||||||
|
switch (oa->role) {
|
||||||
|
case TX_INITIATOR:
|
||||||
|
if (!oa->cmd) {
|
||||||
|
err_reason = tal_fmt(tmpctx,
|
||||||
|
"Unexpected COMMIT_RCVD %s",
|
||||||
|
tal_hex(msg, msg));
|
||||||
|
|
||||||
|
unsaved_channel_disconnect(channel, LOG_UNUSUAL,
|
||||||
|
err_reason);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
response = json_stream_success(oa->cmd);
|
||||||
|
json_add_string(response, "channel_id",
|
||||||
|
type_to_string(tmpctx,
|
||||||
|
struct channel_id,
|
||||||
|
&channel->cid));
|
||||||
|
json_add_psbt(response, "psbt", psbt);
|
||||||
|
json_add_bool(response, "commitments_secured", true);
|
||||||
|
/* For convenience sake, we include the funding outnum */
|
||||||
|
json_add_num(response, "funding_outnum", funding_outnum);
|
||||||
|
if (oa->our_upfront_shutdown_script) {
|
||||||
|
json_add_hex_talarr(response, "close_to",
|
||||||
|
oa->our_upfront_shutdown_script);
|
||||||
|
/* FIXME: also include the output as address */
|
||||||
|
}
|
||||||
|
|
||||||
|
was_pending(command_success(cmd, response));
|
||||||
|
return;
|
||||||
|
case TX_ACCEPTER:
|
||||||
|
payload = tal(dualopend, struct openchannel2_psbt_payload);
|
||||||
|
payload->ld = ld;
|
||||||
|
payload->dualopend = dualopend;
|
||||||
|
tal_add_destructor2(dualopend,
|
||||||
|
openchannel2_psbt_remove_dualopend,
|
||||||
|
payload);
|
||||||
|
// FIXME: payload->channel = channel;
|
||||||
|
payload->psbt = clone_psbt(payload, inflight->funding_psbt);
|
||||||
|
|
||||||
|
/* We don't have a command, so set to NULL here */
|
||||||
|
// FIXME: payload->channel->openchannel_signed_cmd = NULL;
|
||||||
|
/* We call out to hook who will
|
||||||
|
* provide signatures for us! */
|
||||||
|
plugin_hook_call_openchannel2_sign(ld, payload);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
abort();
|
||||||
|
|
||||||
|
failed:
|
||||||
|
if (cmd) {
|
||||||
|
was_pending(command_fail(cmd, LIGHTNINGD,
|
||||||
|
"%s", err_reason));
|
||||||
|
}
|
||||||
|
subd_release_channel(dualopend, channel);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned int dual_opend_msg(struct subd *dualopend,
|
static unsigned int dual_opend_msg(struct subd *dualopend,
|
||||||
const u8 *msg, const int *fds)
|
const u8 *msg, const int *fds)
|
||||||
{
|
{
|
||||||
enum dualopend_wire t = fromwire_peektype(msg);
|
enum dualopend_wire t = fromwire_peektype(msg);
|
||||||
|
struct channel *channel = dualopend->channel;
|
||||||
/* FIXME: might be channel? */
|
|
||||||
struct uncommitted_channel *uc = dualopend->channel;
|
|
||||||
|
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case WIRE_DUALOPEND_GOT_OFFER:
|
case WIRE_DUALOPEND_GOT_OFFER:
|
||||||
@ -2242,32 +2152,10 @@ static unsigned int dual_opend_msg(struct subd *dualopend,
|
|||||||
rbf_got_offer(dualopend, msg);
|
rbf_got_offer(dualopend, msg);
|
||||||
return 0;
|
return 0;
|
||||||
case WIRE_DUALOPEND_PSBT_CHANGED:
|
case WIRE_DUALOPEND_PSBT_CHANGED:
|
||||||
if (uc->fc) {
|
handle_psbt_changed(dualopend, channel, msg);
|
||||||
if (!uc->fc->cmd) {
|
|
||||||
log_unusual(dualopend->log,
|
|
||||||
"Unexpected PSBT_CHANGED %s",
|
|
||||||
tal_hex(tmpctx, msg));
|
|
||||||
tal_free(dualopend);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
opener_psbt_changed(dualopend, uc, msg);
|
|
||||||
} else
|
|
||||||
accepter_psbt_changed(dualopend, msg);
|
|
||||||
return 0;
|
return 0;
|
||||||
case WIRE_DUALOPEND_COMMIT_RCVD:
|
case WIRE_DUALOPEND_COMMIT_RCVD:
|
||||||
if (uc->fc) {
|
handle_commit_received(dualopend, channel, msg);
|
||||||
if (!uc->fc->cmd) {
|
|
||||||
log_unusual(dualopend->log,
|
|
||||||
"Unexpected COMMIT_RCVD %s",
|
|
||||||
tal_hex(tmpctx, msg));
|
|
||||||
tal_free(dualopend);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
opener_commit_received(dualopend,
|
|
||||||
uc, fds, msg);
|
|
||||||
} else
|
|
||||||
accepter_commit_received(dualopend,
|
|
||||||
uc, fds, msg);
|
|
||||||
return 0;
|
return 0;
|
||||||
case WIRE_DUALOPEND_RBF_VALIDATE:
|
case WIRE_DUALOPEND_RBF_VALIDATE:
|
||||||
handle_validate_rbf(dualopend, msg);
|
handle_validate_rbf(dualopend, msg);
|
||||||
|
@ -1651,7 +1651,6 @@ static u8 *accepter_commits(struct state *state,
|
|||||||
pbase,
|
pbase,
|
||||||
&remote_sig,
|
&remote_sig,
|
||||||
tx_state->psbt,
|
tx_state->psbt,
|
||||||
&state->channel_id,
|
|
||||||
&state->their_points.revocation,
|
&state->their_points.revocation,
|
||||||
&state->their_points.payment,
|
&state->their_points.payment,
|
||||||
&state->their_points.htlc,
|
&state->their_points.htlc,
|
||||||
@ -2145,7 +2144,6 @@ static u8 *opener_commits(struct state *state,
|
|||||||
pbase,
|
pbase,
|
||||||
&remote_sig,
|
&remote_sig,
|
||||||
tx_state->psbt,
|
tx_state->psbt,
|
||||||
&state->channel_id,
|
|
||||||
&state->their_points.revocation,
|
&state->their_points.revocation,
|
||||||
&state->their_points.payment,
|
&state->their_points.payment,
|
||||||
&state->their_points.htlc,
|
&state->their_points.htlc,
|
||||||
|
@ -126,7 +126,6 @@ msgdata,dualopend_commit_rcvd,remote_first_commit,bitcoin_tx,
|
|||||||
msgdata,dualopend_commit_rcvd,pbase,?penalty_base,
|
msgdata,dualopend_commit_rcvd,pbase,?penalty_base,
|
||||||
msgdata,dualopend_commit_rcvd,first_commit_sig,bitcoin_signature,
|
msgdata,dualopend_commit_rcvd,first_commit_sig,bitcoin_signature,
|
||||||
msgdata,dualopend_commit_rcvd,psbt,wally_psbt,
|
msgdata,dualopend_commit_rcvd,psbt,wally_psbt,
|
||||||
msgdata,dualopend_commit_rcvd,channel_id,channel_id,
|
|
||||||
msgdata,dualopend_commit_rcvd,revocation_basepoint,pubkey,
|
msgdata,dualopend_commit_rcvd,revocation_basepoint,pubkey,
|
||||||
msgdata,dualopend_commit_rcvd,payment_basepoint,pubkey,
|
msgdata,dualopend_commit_rcvd,payment_basepoint,pubkey,
|
||||||
msgdata,dualopend_commit_rcvd,htlc_basepoint,pubkey,
|
msgdata,dualopend_commit_rcvd,htlc_basepoint,pubkey,
|
||||||
|
Can't render this file because it has a wrong number of fields in line 13.
|
8
openingd/dualopend_wiregen.c
generated
8
openingd/dualopend_wiregen.c
generated
@ -460,7 +460,7 @@ bool fromwire_dualopend_rbf_valid(const void *p)
|
|||||||
/* WIRE: DUALOPEND_COMMIT_RCVD */
|
/* WIRE: DUALOPEND_COMMIT_RCVD */
|
||||||
/* dualopend->master: ready to commit channel open to database and */
|
/* dualopend->master: ready to commit channel open to database and */
|
||||||
/* get some signatures for the funding_tx. */
|
/* 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 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)
|
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, struct amount_sat our_channel_reserve_satoshis, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey)
|
||||||
{
|
{
|
||||||
u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey);
|
u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey);
|
||||||
u16 remote_shutdown_len = tal_count(remote_shutdown_scriptpubkey);
|
u16 remote_shutdown_len = tal_count(remote_shutdown_scriptpubkey);
|
||||||
@ -477,7 +477,6 @@ u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *
|
|||||||
}
|
}
|
||||||
towire_bitcoin_signature(&p, first_commit_sig);
|
towire_bitcoin_signature(&p, first_commit_sig);
|
||||||
towire_wally_psbt(&p, psbt);
|
towire_wally_psbt(&p, psbt);
|
||||||
towire_channel_id(&p, channel_id);
|
|
||||||
towire_pubkey(&p, revocation_basepoint);
|
towire_pubkey(&p, revocation_basepoint);
|
||||||
towire_pubkey(&p, payment_basepoint);
|
towire_pubkey(&p, payment_basepoint);
|
||||||
towire_pubkey(&p, htlc_basepoint);
|
towire_pubkey(&p, htlc_basepoint);
|
||||||
@ -498,7 +497,7 @@ u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *
|
|||||||
|
|
||||||
return memcheck(p, tal_count(p));
|
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 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)
|
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, struct amount_sat *our_channel_reserve_satoshis, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey)
|
||||||
{
|
{
|
||||||
u16 local_shutdown_len;
|
u16 local_shutdown_len;
|
||||||
u16 remote_shutdown_len;
|
u16 remote_shutdown_len;
|
||||||
@ -518,7 +517,6 @@ bool fromwire_dualopend_commit_rcvd(const tal_t *ctx, const void *p, struct chan
|
|||||||
}
|
}
|
||||||
fromwire_bitcoin_signature(&cursor, &plen, first_commit_sig);
|
fromwire_bitcoin_signature(&cursor, &plen, first_commit_sig);
|
||||||
*psbt = fromwire_wally_psbt(ctx, &cursor, &plen);
|
*psbt = fromwire_wally_psbt(ctx, &cursor, &plen);
|
||||||
fromwire_channel_id(&cursor, &plen, channel_id);
|
|
||||||
fromwire_pubkey(&cursor, &plen, revocation_basepoint);
|
fromwire_pubkey(&cursor, &plen, revocation_basepoint);
|
||||||
fromwire_pubkey(&cursor, &plen, payment_basepoint);
|
fromwire_pubkey(&cursor, &plen, payment_basepoint);
|
||||||
fromwire_pubkey(&cursor, &plen, htlc_basepoint);
|
fromwire_pubkey(&cursor, &plen, htlc_basepoint);
|
||||||
@ -966,4 +964,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak)
|
|||||||
*leak = fromwire_bool(&cursor, &plen);
|
*leak = fromwire_bool(&cursor, &plen);
|
||||||
return cursor != NULL;
|
return cursor != NULL;
|
||||||
}
|
}
|
||||||
// SHA256STAMP:0f0daed93a4de2552ca122b969c4ac215ab89e3d5babc727b963fcf02f85980d
|
// SHA256STAMP:523781b6cb29d5c57de5819abb73f492b34e9b42a91b9304a38315b194f9c85c
|
||||||
|
6
openingd/dualopend_wiregen.h
generated
6
openingd/dualopend_wiregen.h
generated
@ -129,8 +129,8 @@ bool fromwire_dualopend_rbf_valid(const void *p);
|
|||||||
/* WIRE: DUALOPEND_COMMIT_RCVD */
|
/* WIRE: DUALOPEND_COMMIT_RCVD */
|
||||||
/* dualopend->master: ready to commit channel open to database and */
|
/* dualopend->master: ready to commit channel open to database and */
|
||||||
/* get some signatures for the funding_tx. */
|
/* 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 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);
|
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, 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);
|
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, struct amount_sat *our_channel_reserve_satoshis, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey);
|
||||||
|
|
||||||
/* WIRE: DUALOPEND_PSBT_CHANGED */
|
/* WIRE: DUALOPEND_PSBT_CHANGED */
|
||||||
/* dualopend->master: peer updated the psbt */
|
/* dualopend->master: peer updated the psbt */
|
||||||
@ -223,4 +223,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak);
|
|||||||
|
|
||||||
|
|
||||||
#endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */
|
#endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */
|
||||||
// SHA256STAMP:0f0daed93a4de2552ca122b969c4ac215ab89e3d5babc727b963fcf02f85980d
|
// SHA256STAMP:523781b6cb29d5c57de5819abb73f492b34e9b42a91b9304a38315b194f9c85c
|
||||||
|
Loading…
Reference in New Issue
Block a user