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

Function handle_commit_ready

lightningd/dual_open_control.c:3771–3958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3769}
3770
3771static void handle_commit_ready(struct subd *dualopend,
3772 struct channel *channel,
3773 const u8 *msg)
3774{
3775 struct lightningd *ld = dualopend->ld;
3776 struct channel_info channel_info;
3777 struct bitcoin_outpoint funding;
3778 u16 lease_chan_max_ppt;
3779 u32 feerate_funding, feerate_commitment, lease_expiry,
3780 lease_chan_max_msat, lease_blockheight_start;
3781 struct amount_sat total_funding, funding_ours, lease_fee, lease_amt;
3782 u8 *remote_upfront_shutdown_script,
3783 *local_upfront_shutdown_script;
3784 struct wally_psbt *psbt;
3785 struct channel_inflight *inflight;
3786 struct channel_type *channel_type;
3787 secp256k1_ecdsa_signature *lease_commit_sig;
3788
3789 if (!fromwire_dualopend_commit_ready(tmpctx, msg,
3790 &channel_info.their_config,
3791 &psbt,
3792 &channel_info.theirbase.revocation,
3793 &channel_info.theirbase.payment,
3794 &channel_info.theirbase.htlc,
3795 &channel_info.theirbase.delayed_payment,
3796 &channel_info.remote_per_commit,
3797 &channel_info.remote_fundingkey,
3798 &funding,
3799 &total_funding,
3800 &funding_ours,
3801 &channel->channel_flags,
3802 &feerate_funding,
3803 &feerate_commitment,
3804 &local_upfront_shutdown_script,
3805 &remote_upfront_shutdown_script,
3806 &lease_amt,
3807 &lease_blockheight_start,
3808 &lease_expiry,
3809 &lease_fee,
3810 &lease_commit_sig,
3811 &lease_chan_max_msat,
3812 &lease_chan_max_ppt,
3813 &channel_type)) {
3814 channel_internal_error(channel,
3815 "Bad WIRE_DUALOPEND_COMMIT_READY: %s",
3816 tal_hex(msg, msg));
3817 channel->open_attempt = tal_free(channel->open_attempt);
3818 notify_channel_open_failed(channel->peer->ld, &channel->cid);
3819 return;
3820 }
3821
3822 /* A funding outpoint funds at most one channel; refuse a second
3823 * channel (or candidate) reusing one we already have, as the
3824 * single-funded path does in opening_control.c. Our funding pubkey
3825 * is derived per channel, so an honest negotiation cannot produce
3826 * this; refusing it keeps a duplicate outpoint out of the wallet. */
3827 {
3828 struct channel *other;

Callers 1

dual_opend_msgFunction · 0.85

Calls 14

tal_hexFunction · 0.85
tal_freeFunction · 0.85
fmt_bitcoin_outpointFunction · 0.85
channel_id_in_useFunction · 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

Tested by

no test coverage detected