MCPcopy Create free account
hub / github.com/ElementsProject/lightning / process_dev_forget_channel

Function process_dev_forget_channel

lightningd/peer_control.c:4221–4250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4219};
4220
4221static 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
4252static struct command_result *json_dev_forget_channel(struct command *cmd,
4253 const char *buffer,

Callers

nothing calls this directly

Calls 8

json_add_boolFunction · 0.85
json_add_txidFunction · 0.85
towire_errorfmtFunction · 0.85
was_pendingFunction · 0.70
command_failFunction · 0.70
json_stream_successFunction · 0.70
delete_channelFunction · 0.70
command_successFunction · 0.70

Tested by

no test coverage detected