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

Function handle_commit_ready

lightningd/dual_open_control.c:3490–3612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3488}
3489
3490static void handle_commit_ready(struct subd *dualopend,
3491 struct channel *channel,
3492 const u8 *msg)
3493{
3494 struct lightningd *ld = dualopend->ld;
3495 struct channel_info channel_info;
3496 struct bitcoin_outpoint funding;
3497 u16 lease_chan_max_ppt;
3498 u32 feerate_funding, feerate_commitment, lease_expiry,
3499 lease_chan_max_msat, lease_blockheight_start;
3500 struct amount_sat total_funding, funding_ours, lease_fee, lease_amt;
3501 u8 *remote_upfront_shutdown_script,
3502 *local_upfront_shutdown_script;
3503 struct wally_psbt *psbt;
3504 struct channel_inflight *inflight;
3505 struct channel_type *channel_type;
3506 secp256k1_ecdsa_signature *lease_commit_sig;
3507
3508 if (!fromwire_dualopend_commit_ready(tmpctx, msg,
3509 &channel_info.their_config,
3510 &psbt,
3511 &channel_info.theirbase.revocation,
3512 &channel_info.theirbase.payment,
3513 &channel_info.theirbase.htlc,
3514 &channel_info.theirbase.delayed_payment,
3515 &channel_info.remote_per_commit,
3516 &channel_info.remote_fundingkey,
3517 &funding,
3518 &total_funding,
3519 &funding_ours,
3520 &channel->channel_flags,
3521 &feerate_funding,
3522 &feerate_commitment,
3523 &local_upfront_shutdown_script,
3524 &remote_upfront_shutdown_script,
3525 &lease_amt,
3526 &lease_blockheight_start,
3527 &lease_expiry,
3528 &lease_fee,
3529 &lease_commit_sig,
3530 &lease_chan_max_msat,
3531 &lease_chan_max_ppt,
3532 &channel_type)) {
3533 channel_internal_error(channel,
3534 "Bad WIRE_DUALOPEND_COMMIT_READY: %s",
3535 tal_hex(msg, msg));
3536 channel->open_attempt = tal_free(channel->open_attempt);
3537 notify_channel_open_failed(channel->peer->ld, &channel->cid);
3538 return;
3539 }
3540
3541 /* We need to update the channel reserve on the config */
3542 channel_update_reserve(channel,
3543 &channel_info.their_config,
3544 total_funding);
3545
3546 /* First time (not an RBF) */
3547 if (channel->state == DUALOPEND_OPEN_INIT) {

Callers 1

dual_opend_msgFunction · 0.85

Calls 10

tal_hexFunction · 0.85
tal_freeFunction · 0.85
channel_gossip_initFunction · 0.85
wallet_update_channelFunction · 0.85
channel_internal_errorFunction · 0.70
channel_update_reserveFunction · 0.70
wallet_commit_channelFunction · 0.70
subd_send_msgFunction · 0.70
fmt_channel_idFunction · 0.50

Tested by

no test coverage detected