jsonrpc: Refuse to forget a channel with an open HTLC

... instead provide useful suggestions as to how to close it.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2018-02-28 23:24:58 +01:00 committed by Rusty Russell
parent aef5780f36
commit a90502d917

View File

@ -1086,6 +1086,15 @@ static void json_dev_forget_channel(struct command *cmd, const char *buffer,
return;
}
if (channel_has_htlc_out(forget->channel) ||
channel_has_htlc_in(forget->channel)) {
command_fail(cmd, "This channel has HTLCs attached and it is "
"not safe to forget it. Please use `close` "
"or `dev-fail` instead.");
return;
}
bitcoind_gettxout(cmd->ld->topology->bitcoind,
&forget->channel->funding_txid,
forget->channel->funding_outnum,