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

Function setup_channel_funder

openingd/openingd.c:255–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255static bool setup_channel_funder(struct state *state)
256{
257#if DEVELOPER
258 /* --dev-force-tmp-channel-id specified */
259 if (dev_force_tmp_channel_id)
260 state->channel_id = *dev_force_tmp_channel_id;
261#endif
262 /* BOLT #2:
263 *
264 * The sending node:
265 *...
266 * - if both nodes advertised `option_support_large_channel`:
267 * - MAY set `funding_satoshis` greater than or equal to 2^24 satoshi.
268 * - otherwise:
269 * - MUST set `funding_satoshis` to less than 2^24 satoshi.
270 */
271 if (!feature_negotiated(state->our_features,
272 state->their_features, OPT_LARGE_CHANNELS)
273 && amount_sat_greater(state->funding_sats,
274 chainparams->max_funding)) {
275 status_failed(STATUS_FAIL_MASTER_IO,
276 "funding_satoshis must be < %s, not %s",
277 type_to_string(tmpctx, struct amount_sat,
278 &chainparams->max_funding),
279 type_to_string(tmpctx, struct amount_sat,
280 &state->funding_sats));
281 return false;
282 }
283
284 return true;
285}
286
287static void set_remote_upfront_shutdown(struct state *state,
288 u8 *shutdown_scriptpubkey STEALS)

Callers 1

funder_channel_startFunction · 0.85

Calls 4

amount_sat_greaterFunction · 0.85
feature_negotiatedFunction · 0.50
status_failedFunction · 0.50
type_to_stringClass · 0.50

Tested by

no test coverage detected