From f4b4f772f3f24f59c918f92fa0813d125d9c710e Mon Sep 17 00:00:00 2001 From: niftynei Date: Tue, 31 Oct 2023 16:34:37 -0500 Subject: [PATCH] dualfund, bump: when bumping a channel make sure it's in ok state If we disconnect, we lose the open_attempt record. Which is fine, but we should prevent the user from starting another RBF if the last one isn't done yet! --- lightningd/dual_open_control.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 648307f9b..5702cb2dd 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -2497,6 +2497,7 @@ json_openchannel_bump(struct command *cmd, struct wally_psbt *psbt; u32 last_feerate_perkw, next_feerate_min, *feerate_per_kw_funding; struct open_attempt *oa; + struct channel_inflight *inflight; if (!param_check(cmd, buffer, params, p_req("channel_id", param_channel_id, &cid), @@ -2599,9 +2600,22 @@ json_openchannel_bump(struct command *cmd, "Only the channel opener can initiate an" " RBF attempt"); + inflight = channel_current_inflight(channel); + if (!inflight) { + return command_fail(cmd, FUNDING_STATE_INVALID, + "No inflight for this channel exists."); + } + + if (!inflight->remote_tx_sigs) { + return command_fail(cmd, FUNDING_STATE_INVALID, + "Funding sigs for this channel not " + "secured, see `openchannel_signed`"); + } + if (command_check_only(cmd)) return command_check_done(cmd); + /* Ok, we're kosher to start */ channel->open_attempt = oa = new_channel_open_attempt(channel); oa->funding = *amount;