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

Function process_check_funding_broadcast

lightningd/channel_control.c:2146–2181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2144};
2145
2146static void process_check_funding_broadcast(struct bitcoind *bitcoind,
2147 const struct bitcoin_tx_output *txout,
2148 void *arg)
2149{
2150 struct channel_to_cancel *cc = arg;
2151 struct peer *peer;
2152 struct channel *cancel;
2153
2154 /* Peer could have errored out while we were waiting */
2155 peer = peer_by_id(bitcoind->ld, &cc->peer);
2156 if (!peer)
2157 goto cleanup;
2158 cancel = find_channel_by_id(peer, &cc->cid);
2159 if (!cancel)
2160 goto cleanup;
2161
2162 if (txout != NULL) {
2163 for (size_t i = 0; i < tal_count(cancel->forgets); i++)
2164 was_pending(command_fail(cancel->forgets[i],
2165 FUNDING_CANCEL_NOT_SAFE,
2166 "The funding transaction has been broadcast, "
2167 "please consider `close` or `dev-fail`! "));
2168 tal_free(cancel->forgets);
2169 cancel->forgets = tal_arr(cancel, struct command *, 0);
2170 goto cleanup;
2171 }
2172
2173 char *error_reason = "Cancel channel by our RPC "
2174 "command before funding "
2175 "transaction broadcast.";
2176 forget_channel(cancel, error_reason);
2177
2178cleanup:
2179 tal_free(cc);
2180 return;
2181}
2182
2183struct command_result *cancel_channel_before_broadcast(struct command *cmd,
2184 struct peer *peer)

Callers

nothing calls this directly

Calls 6

peer_by_idFunction · 0.85
tal_freeFunction · 0.85
forget_channelFunction · 0.85
find_channel_by_idFunction · 0.70
was_pendingFunction · 0.70
command_failFunction · 0.70

Tested by

no test coverage detected