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

Function funder_channel_complete

openingd/openingd.c:785–827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783}
784
785static u8 *funder_channel_complete(struct state *state)
786{
787 /* Remote commitment tx */
788 struct bitcoin_tx *tx;
789 struct bitcoin_signature sig;
790 struct amount_msat local_msat;
791 struct penalty_base *pbase;
792
793 /* Update the billboard about what we're doing*/
794 peer_billboard(false,
795 "Funding channel con't: continuing with funding_txid %s",
796 fmt_bitcoin_txid(tmpctx, &state->funding.txid));
797
798 /* We recalculate the local_msat from cached values; should
799 * succeed because we checked it earlier */
800 if (!amount_sat_sub_msat(&local_msat, state->funding_sats, state->push_msat))
801 status_failed(STATUS_FAIL_INTERNAL_ERROR,
802 "push_msat %s > funding %s?",
803 fmt_amount_msat(tmpctx, state->push_msat),
804 fmt_amount_sat(tmpctx, state->funding_sats));
805
806 if (!funder_finalize_channel_setup(state, local_msat, &sig, &tx,
807 &pbase))
808 return NULL;
809
810 return towire_openingd_funder_reply(state,
811 &state->remoteconf,
812 tx,
813 pbase,
814 &sig,
815 &state->their_points.revocation,
816 &state->their_points.payment,
817 &state->their_points.htlc,
818 &state->their_points.delayed_payment,
819 &state->first_per_commitment_point[REMOTE],
820 state->minimum_depth,
821 &state->their_funding_pubkey,
822 &state->funding,
823 state->feerate_per_kw,
824 state->localconf.channel_reserve,
825 state->upfront_shutdown_script[REMOTE],
826 state->channel_type);
827}
828
829/*~ The peer sent us an `open_channel`, that means we're the fundee. */
830static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)

Callers 1

handle_master_inFunction · 0.85

Calls 7

fmt_bitcoin_txidFunction · 0.85
amount_sat_sub_msatFunction · 0.85
peer_billboardFunction · 0.50
status_failedFunction · 0.50
fmt_amount_msatFunction · 0.50
fmt_amount_satFunction · 0.50

Tested by

no test coverage detected