mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
df: check inflights when deciding whether or not to allow command
We were missing the inflight state checks before allowing to proceed with a command.
This commit is contained in:
@@ -1761,6 +1761,10 @@ json_openchannel_signed(struct command *cmd,
|
|||||||
"Commitments for this channel not "
|
"Commitments for this channel not "
|
||||||
"yet secured, see `openchannel_update`");
|
"yet secured, see `openchannel_update`");
|
||||||
|
|
||||||
|
if (list_empty(&channel->inflights))
|
||||||
|
return command_fail(cmd, LIGHTNINGD,
|
||||||
|
"Channel open not initialized yet.");
|
||||||
|
|
||||||
if (channel->openchannel_signed_cmd)
|
if (channel->openchannel_signed_cmd)
|
||||||
return command_fail(cmd, LIGHTNINGD,
|
return command_fail(cmd, LIGHTNINGD,
|
||||||
"Already sent sigs, waiting for peer's");
|
"Already sent sigs, waiting for peer's");
|
||||||
@@ -1972,8 +1976,11 @@ static struct command_result *json_openchannel_init(struct command *cmd,
|
|||||||
return command_fail(cmd, FUNDING_PEER_NOT_CONNECTED,
|
return command_fail(cmd, FUNDING_PEER_NOT_CONNECTED,
|
||||||
"Peer not connected");
|
"Peer not connected");
|
||||||
|
|
||||||
if (channel->open_attempt)
|
if (channel->open_attempt
|
||||||
return command_fail(cmd, LIGHTNINGD, "Already funding channel");
|
|| !list_empty(&channel->inflights))
|
||||||
|
return command_fail(cmd, LIGHTNINGD, "Channel funding"
|
||||||
|
" in-progress. %s",
|
||||||
|
channel_state_name(channel));
|
||||||
|
|
||||||
#if EXPERIMENTAL_FEATURES
|
#if EXPERIMENTAL_FEATURES
|
||||||
if (!feature_negotiated(cmd->ld->our_features,
|
if (!feature_negotiated(cmd->ld->our_features,
|
||||||
|
|||||||
Reference in New Issue
Block a user