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

Function process_dev_forget_channel

lightningd/peer_control.c:2929–2958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2927};
2928
2929static void process_dev_forget_channel(struct bitcoind *bitcoind UNUSED,
2930 const struct bitcoin_tx_output *txout,
2931 void *arg)
2932{
2933 struct json_stream *response;
2934 struct dev_forget_channel_cmd *forget = arg;
2935 if (txout != NULL && !forget->force) {
2936 was_pending(command_fail(forget->cmd, LIGHTNINGD,
2937 "Cowardly refusing to forget channel with an "
2938 "unspent funding output, if you know what "
2939 "you're doing you can override with "
2940 "`force=true`, otherwise consider `close` or "
2941 "`dev-fail`! If you force and the channel "
2942 "confirms we will not track the funds in the "
2943 "channel"));
2944 return;
2945 }
2946 response = json_stream_success(forget->cmd);
2947 json_add_bool(response, "forced", forget->force);
2948 json_add_bool(response, "funding_unspent", txout != NULL);
2949 json_add_txid(response, "funding_txid", &forget->channel->funding.txid);
2950
2951 /* Set error so we don't try to reconnect. */
2952 forget->channel->error = towire_errorfmt(forget->channel,
2953 &forget->channel->cid,
2954 "dev_forget_channel");
2955 delete_channel(forget->channel);
2956
2957 was_pending(command_success(forget->cmd, response));
2958}
2959
2960static struct command_result *json_dev_forget_channel(struct command *cmd,
2961 const char *buffer,

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected