Browse Source

channel_fallen_behind: break out functionality into two methods

We'll need this for moving 'waiting for locked' into dualopend.
ppa
niftynei 4 years ago
committed by Christian Decker
parent
commit
9cb2a15858
  1. 25
      lightningd/channel_control.c
  2. 3
      lightningd/channel_control.h

25
lightningd/channel_control.c

@ -261,16 +261,8 @@ static void peer_got_shutdown(struct channel *channel, const u8 *msg)
wallet_channel_save(ld->wallet, channel);
}
static void channel_fail_fallen_behind(struct channel *channel, const u8 *msg)
void channel_fallen_behind(struct channel *channel, const u8 *msg)
{
if (!fromwire_channeld_fail_fallen_behind(channel, msg,
cast_const2(struct pubkey **,
&channel->future_per_commitment_point))) {
channel_internal_error(channel,
"bad channel_fail_fallen_behind %s",
tal_hex(tmpctx, msg));
return;
}
/* per_commitment_point is NULL if option_static_remotekey, but we
* use its presence as a flag so set it any valid key in that case. */
@ -293,6 +285,21 @@ static void channel_fail_fallen_behind(struct channel *channel, const u8 *msg)
"Awaiting unilateral close");
}
static void
channel_fail_fallen_behind(struct channel *channel, const u8 *msg)
{
if (!fromwire_channeld_fail_fallen_behind(channel, msg,
cast_const2(struct pubkey **,
&channel->future_per_commitment_point))) {
channel_internal_error(channel,
"bad channel_fail_fallen_behind %s",
tal_hex(tmpctx, msg));
return;
}
channel_fallen_behind(channel, msg);
}
static void peer_start_closingd_after_shutdown(struct channel *channel,
const u8 *msg,
const int *fds)

3
lightningd/channel_control.h

@ -38,4 +38,7 @@ void channel_record_open(struct channel *channel);
/* Forget a channel. Deletes the channel and handles all
* associated waiting commands, if present. Notifies peer if available */
void forget_channel(struct channel *channel, const char *err_msg);
/* A channel has unrecoverably fallen behind */
void channel_fallen_behind(struct channel *channel, const u8 *msg);
#endif /* LIGHTNING_LIGHTNINGD_CHANNEL_CONTROL_H */

Loading…
Cancel
Save