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

Function opening_funder_finished

lightningd/opening_control.c:358–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358static void opening_funder_finished(struct subd *openingd, const u8 *resp,
359 const int *fds,
360 struct funding_channel *fc)
361{
362 struct channel_info channel_info;
363 struct channel_id cid;
364 struct bitcoin_outpoint funding;
365 struct bitcoin_signature remote_commit_sig;
366 struct bitcoin_tx *remote_commit;
367 u32 feerate;
368 struct channel *channel;
369 struct lightningd *ld = openingd->ld;
370 u8 *remote_upfront_shutdown_script;
371 struct peer_fd *peer_fd;
372 struct penalty_base *pbase;
373 struct channel_type *type;
374
375 /* This is a new channel_info.their_config so set its ID to 0 */
376 channel_info.their_config.id = 0;
377
378 if (!fromwire_openingd_funder_reply(resp, resp,
379 &channel_info.their_config,
380 &remote_commit,
381 &pbase,
382 &remote_commit_sig,
383 &channel_info.theirbase.revocation,
384 &channel_info.theirbase.payment,
385 &channel_info.theirbase.htlc,
386 &channel_info.theirbase.delayed_payment,
387 &channel_info.remote_per_commit,
388 &fc->uc->minimum_depth,
389 &channel_info.remote_fundingkey,
390 &funding,
391 &feerate,
392 &fc->uc->our_config.channel_reserve,
393 &remote_upfront_shutdown_script,
394 &type)) {
395 log_broken(fc->uc->log,
396 "bad OPENING_FUNDER_REPLY %s",
397 tal_hex(resp, resp));
398 was_pending(command_fail(fc->cmd, LIGHTNINGD,
399 "bad OPENING_FUNDER_REPLY %s",
400 tal_hex(fc->cmd, resp)));
401 goto cleanup;
402 }
403 remote_commit->chainparams = chainparams;
404
405 peer_fd = new_peer_fd_arr(resp, fds);
406
407 log_debug(ld->log,
408 "%s", type_to_string(tmpctx, struct pubkey,
409 &channel_info.remote_per_commit));
410
411 /* Saved with channel to disk */
412 derive_channel_id(&cid, &funding);
413
414 /* old_remote_per_commit not valid yet, copy valid one. */
415 channel_info.old_remote_per_commit = channel_info.remote_per_commit;

Callers 1

openingd_msgFunction · 0.85

Calls 12

tal_hexFunction · 0.85
was_pendingFunction · 0.85
channel_watch_fundingFunction · 0.85
wallet_penalty_base_addFunction · 0.85
funding_successFunction · 0.85
tal_freeFunction · 0.85
command_failFunction · 0.70
new_peer_fd_arrFunction · 0.70
wallet_commit_channelFunction · 0.70
peer_start_channeldFunction · 0.70
type_to_stringClass · 0.50
derive_channel_idFunction · 0.50

Tested by

no test coverage detected