Skip to content

Commit f4b4f77

Browse files
niftyneirustyrussell
authored andcommitted
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!
1 parent dbcdfd7 commit f4b4f77

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lightningd/dual_open_control.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,6 +2497,7 @@ json_openchannel_bump(struct command *cmd,
24972497
struct wally_psbt *psbt;
24982498
u32 last_feerate_perkw, next_feerate_min, *feerate_per_kw_funding;
24992499
struct open_attempt *oa;
2500+
struct channel_inflight *inflight;
25002501

25012502
if (!param_check(cmd, buffer, params,
25022503
p_req("channel_id", param_channel_id, &cid),
@@ -2599,9 +2600,22 @@ json_openchannel_bump(struct command *cmd,
25992600
"Only the channel opener can initiate an"
26002601
" RBF attempt");
26012602

2603+
inflight = channel_current_inflight(channel);
2604+
if (!inflight) {
2605+
return command_fail(cmd, FUNDING_STATE_INVALID,
2606+
"No inflight for this channel exists.");
2607+
}
2608+
2609+
if (!inflight->remote_tx_sigs) {
2610+
return command_fail(cmd, FUNDING_STATE_INVALID,
2611+
"Funding sigs for this channel not "
2612+
"secured, see `openchannel_signed`");
2613+
}
2614+
26022615
if (command_check_only(cmd))
26032616
return command_check_done(cmd);
26042617

2618+
26052619
/* Ok, we're kosher to start */
26062620
channel->open_attempt = oa = new_channel_open_attempt(channel);
26072621
oa->funding = *amount;

0 commit comments

Comments
 (0)