mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 09:04:22 +01:00
opening: pass two messages to channeld to send to peer
v2 of channel establishment, in the accpeter case, now sends 2 messages to our peer after saving the information to disk (our commitment signatures and our funding transaction signatures)
This commit is contained in:
@@ -415,7 +415,8 @@ static unsigned channel_msg(struct subd *sd, const u8 *msg, const int *fds)
|
||||
|
||||
void peer_start_channeld(struct channel *channel,
|
||||
struct per_peer_state *pps,
|
||||
const u8 **fwd_msgs,
|
||||
const u8 *fwd_msg_1,
|
||||
const u8 *fwd_msg_2,
|
||||
bool reconnected)
|
||||
{
|
||||
u8 *initmsg;
|
||||
@@ -556,8 +557,8 @@ void peer_start_channeld(struct channel *channel,
|
||||
channel->shutdown_scriptpubkey[REMOTE] != NULL,
|
||||
channel->shutdown_scriptpubkey[LOCAL],
|
||||
channel->channel_flags,
|
||||
/* FIXME: pass set of msgs */
|
||||
fwd_msgs ? fwd_msgs[0] : NULL,
|
||||
fwd_msg_1,
|
||||
fwd_msg_2,
|
||||
reached_announce_depth,
|
||||
&last_remote_per_commit_secret,
|
||||
channel->peer->their_features,
|
||||
|
||||
@@ -12,7 +12,8 @@ struct peer;
|
||||
|
||||
void peer_start_channeld(struct channel *channel,
|
||||
struct per_peer_state *pps,
|
||||
const u8 **fwd_msgs,
|
||||
const u8 *fwd_msg_1,
|
||||
const u8 *fwd_msg_2,
|
||||
bool reconnected);
|
||||
|
||||
/* Returns true if subd told, otherwise false. */
|
||||
|
||||
@@ -404,7 +404,7 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp,
|
||||
wallet_penalty_base_add(ld->wallet, channel->dbid, pbase);
|
||||
|
||||
funding_success(channel);
|
||||
peer_start_channeld(channel, pps, NULL, false);
|
||||
peer_start_channeld(channel, pps, NULL, NULL, false);
|
||||
|
||||
cleanup:
|
||||
subd_release_channel(openingd, fc->uc);
|
||||
@@ -418,7 +418,7 @@ static void opening_fundee_finished(struct subd *openingd,
|
||||
const int *fds,
|
||||
struct uncommitted_channel *uc)
|
||||
{
|
||||
const u8 *msgs[1];
|
||||
const u8 *fwd_msg;
|
||||
struct channel_info channel_info;
|
||||
struct bitcoin_signature remote_commit_sig;
|
||||
struct bitcoin_tx *remote_commit;
|
||||
@@ -458,7 +458,7 @@ static void opening_fundee_finished(struct subd *openingd,
|
||||
&push,
|
||||
&channel_flags,
|
||||
&feerate,
|
||||
cast_const2(u8 **, msgs),
|
||||
cast_const2(u8 **, &fwd_msg),
|
||||
&uc->our_config.channel_reserve,
|
||||
&local_upfront_shutdown_script,
|
||||
&remote_upfront_shutdown_script)) {
|
||||
@@ -516,7 +516,7 @@ static void opening_fundee_finished(struct subd *openingd,
|
||||
wallet_penalty_base_add(ld->wallet, channel->dbid, pbase);
|
||||
|
||||
/* On to normal operation! */
|
||||
peer_start_channeld(channel, pps, msgs, false);
|
||||
peer_start_channeld(channel, pps, fwd_msg, NULL, false);
|
||||
|
||||
subd_release_channel(openingd, uc);
|
||||
uc->open_daemon = NULL;
|
||||
|
||||
@@ -981,7 +981,7 @@ peer_connected_hook_cb(struct peer_connected_hook_payload *payload STEALS,
|
||||
assert(!channel->owner);
|
||||
|
||||
channel->peer->addr = addr;
|
||||
peer_start_channeld(channel, payload->pps, NULL,
|
||||
peer_start_channeld(channel, payload->pps, NULL, NULL,
|
||||
true);
|
||||
tal_free(payload);
|
||||
return;
|
||||
|
||||
@@ -461,7 +461,8 @@ struct channel *peer_normal_channel(struct peer *peer UNNEEDED)
|
||||
/* Generated stub for peer_start_channeld */
|
||||
void peer_start_channeld(struct channel *channel UNNEEDED,
|
||||
struct per_peer_state *pps UNNEEDED,
|
||||
const u8 **fwd_msgs UNNEEDED,
|
||||
const u8 *fwd_msg_1 UNNEEDED,
|
||||
const u8 *fwd_msg_2 UNNEEDED,
|
||||
bool reconnected UNNEEDED)
|
||||
{ fprintf(stderr, "peer_start_channeld called!\n"); abort(); }
|
||||
/* Generated stub for peer_start_closingd */
|
||||
|
||||
Reference in New Issue
Block a user