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

Function process_dev_forget_channel

lightningd/peer_control.c:3941–3970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3939};
3940
3941static void process_dev_forget_channel(struct bitcoind *bitcoind UNUSED,
3942 const struct bitcoin_tx_output *txout,
3943 void *arg)
3944{
3945 struct json_stream *response;
3946 struct dev_forget_channel_cmd *forget = arg;
3947 if (txout != NULL && !forget->force) {
3948 was_pending(command_fail(forget->cmd, LIGHTNINGD,
3949 "Cowardly refusing to forget channel with an "
3950 "unspent funding output, if you know what "
3951 "you're doing you can override with "
3952 "`force=true`, otherwise consider `close` or "
3953 "`dev-fail`! If you force and the channel "
3954 "confirms we will not track the funds in the "
3955 "channel"));
3956 return;
3957 }
3958 response = json_stream_success(forget->cmd);
3959 json_add_bool(response, "forced", forget->force);
3960 json_add_bool(response, "funding_unspent", txout != NULL);
3961 json_add_txid(response, "funding_txid", &forget->channel->funding.txid);
3962
3963 /* Set error so we don't try to reconnect. */
3964 forget->channel->error = towire_errorfmt(forget->channel,
3965 &forget->channel->cid,
3966 "dev_forget_channel");
3967 delete_channel(forget->channel, false);
3968
3969 was_pending(command_success(forget->cmd, response));
3970}
3971
3972static struct command_result *json_dev_forget_channel(struct command *cmd,
3973 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