mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-26 20:30:59 +01:00
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!
This commit is contained in:
parent
dbcdfd7d66
commit
f4b4f772f3
1 changed files with 14 additions and 0 deletions
|
@ -2497,6 +2497,7 @@ json_openchannel_bump(struct command *cmd,
|
||||||
struct wally_psbt *psbt;
|
struct wally_psbt *psbt;
|
||||||
u32 last_feerate_perkw, next_feerate_min, *feerate_per_kw_funding;
|
u32 last_feerate_perkw, next_feerate_min, *feerate_per_kw_funding;
|
||||||
struct open_attempt *oa;
|
struct open_attempt *oa;
|
||||||
|
struct channel_inflight *inflight;
|
||||||
|
|
||||||
if (!param_check(cmd, buffer, params,
|
if (!param_check(cmd, buffer, params,
|
||||||
p_req("channel_id", param_channel_id, &cid),
|
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"
|
"Only the channel opener can initiate an"
|
||||||
" RBF attempt");
|
" 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))
|
if (command_check_only(cmd))
|
||||||
return command_check_done(cmd);
|
return command_check_done(cmd);
|
||||||
|
|
||||||
|
|
||||||
/* Ok, we're kosher to start */
|
/* Ok, we're kosher to start */
|
||||||
channel->open_attempt = oa = new_channel_open_attempt(channel);
|
channel->open_attempt = oa = new_channel_open_attempt(channel);
|
||||||
oa->funding = *amount;
|
oa->funding = *amount;
|
||||||
|
|
Loading…
Add table
Reference in a new issue