| 4219 | }; |
| 4220 | |
| 4221 | static void process_dev_forget_channel(struct bitcoind *bitcoind UNUSED, |
| 4222 | const struct bitcoin_tx_output *txout, |
| 4223 | void *arg) |
| 4224 | { |
| 4225 | struct json_stream *response; |
| 4226 | struct dev_forget_channel_cmd *forget = arg; |
| 4227 | if (txout != NULL && !forget->force) { |
| 4228 | was_pending(command_fail(forget->cmd, LIGHTNINGD, |
| 4229 | "Cowardly refusing to forget channel with an " |
| 4230 | "unspent funding output, if you know what " |
| 4231 | "you're doing you can override with " |
| 4232 | "`force=true`, otherwise consider `close` or " |
| 4233 | "`dev-fail`! If you force and the channel " |
| 4234 | "confirms we will not track the funds in the " |
| 4235 | "channel")); |
| 4236 | return; |
| 4237 | } |
| 4238 | response = json_stream_success(forget->cmd); |
| 4239 | json_add_bool(response, "forced", forget->force); |
| 4240 | json_add_bool(response, "funding_unspent", txout != NULL); |
| 4241 | json_add_txid(response, "funding_txid", &forget->channel->funding.txid); |
| 4242 | |
| 4243 | /* Set error so we don't try to reconnect. */ |
| 4244 | forget->channel->error = towire_errorfmt(forget->channel, |
| 4245 | &forget->channel->cid, |
| 4246 | "dev_forget_channel"); |
| 4247 | delete_channel(forget->channel, false); |
| 4248 | |
| 4249 | was_pending(command_success(forget->cmd, response)); |
| 4250 | } |
| 4251 | |
| 4252 | static struct command_result *json_dev_forget_channel(struct command *cmd, |
| 4253 | const char *buffer, |
nothing calls this directly
no test coverage detected