df: differentiate error message between

There's a difference between "no channel" and "channel in progress
but no open available to cancel"
This commit is contained in:
niftynei 2021-04-29 15:17:31 -05:00 committed by Rusty Russell
parent 4ae9e0c73f
commit 260adb824e

View file

@ -1935,9 +1935,13 @@ json_openchannel_abort(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) {
if (list_empty(&channel->inflights))
return command_fail(cmd, FUNDING_STATE_INVALID,
"Channel open not in progress");
return command_fail(cmd, FUNDING_STATE_INVALID, return command_fail(cmd, FUNDING_STATE_INVALID,
"Channel open not in progress"); "Sigs already exchanged, can't cancel");
}
if (channel->open_attempt->cmd) if (channel->open_attempt->cmd)
return command_fail(cmd, FUNDING_STATE_INVALID, return command_fail(cmd, FUNDING_STATE_INVALID,