| 807 | } |
| 808 | |
| 809 | static u8 *funder_channel_complete(struct state *state) |
| 810 | { |
| 811 | /* Remote commitment tx */ |
| 812 | struct bitcoin_tx *tx; |
| 813 | struct bitcoin_signature sig; |
| 814 | struct amount_msat local_msat; |
| 815 | struct penalty_base *pbase; |
| 816 | |
| 817 | /* Update the billboard about what we're doing*/ |
| 818 | peer_billboard(false, |
| 819 | "Funding channel con't: continuing with funding_txid %s", |
| 820 | type_to_string(tmpctx, struct bitcoin_txid, &state->funding.txid)); |
| 821 | |
| 822 | /* We recalculate the local_msat from cached values; should |
| 823 | * succeed because we checked it earlier */ |
| 824 | if (!amount_sat_sub_msat(&local_msat, state->funding_sats, state->push_msat)) |
| 825 | status_failed(STATUS_FAIL_INTERNAL_ERROR, |
| 826 | "push_msat %s > funding %s?", |
| 827 | type_to_string(tmpctx, struct amount_msat, |
| 828 | &state->push_msat), |
| 829 | type_to_string(tmpctx, struct amount_sat, |
| 830 | &state->funding_sats)); |
| 831 | |
| 832 | if (!funder_finalize_channel_setup(state, local_msat, &sig, &tx, |
| 833 | &pbase)) |
| 834 | return NULL; |
| 835 | |
| 836 | return towire_openingd_funder_reply(state, |
| 837 | &state->remoteconf, |
| 838 | tx, |
| 839 | pbase, |
| 840 | &sig, |
| 841 | &state->their_points.revocation, |
| 842 | &state->their_points.payment, |
| 843 | &state->their_points.htlc, |
| 844 | &state->their_points.delayed_payment, |
| 845 | &state->first_per_commitment_point[REMOTE], |
| 846 | state->minimum_depth, |
| 847 | &state->their_funding_pubkey, |
| 848 | &state->funding, |
| 849 | state->feerate_per_kw, |
| 850 | state->localconf.channel_reserve, |
| 851 | state->upfront_shutdown_script[REMOTE], |
| 852 | state->channel_type); |
| 853 | } |
| 854 | |
| 855 | /*~ The peer sent us an `open_channel`, that means we're the fundee. */ |
| 856 | static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg) |
no test coverage detected