diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index 924cb0fec..5f1e54466 100644 --- a/lightningd/channel_control.c +++ b/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) diff --git a/lightningd/channel_control.h b/lightningd/channel_control.h index 2a30efd7c..5290a64a9 100644 --- a/lightningd/channel_control.h +++ b/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 */