| 3788 | } |
| 3789 | |
| 3790 | int main(int argc, char *argv[]) |
| 3791 | { |
| 3792 | common_setup(argv[0]); |
| 3793 | |
| 3794 | struct pollfd pollfd[2]; |
| 3795 | struct state *state = tal(NULL, struct state); |
| 3796 | struct secret *none; |
| 3797 | struct fee_states *fee_states; |
| 3798 | enum side opener; |
| 3799 | u8 *msg; |
| 3800 | struct amount_sat total_funding; |
| 3801 | struct amount_msat our_msat; |
| 3802 | const struct channel_type *type; |
| 3803 | |
| 3804 | subdaemon_setup(argc, argv); |
| 3805 | |
| 3806 | /* Init the holder for the funding transaction attempt */ |
| 3807 | state->tx_state = new_tx_state(state); |
| 3808 | |
| 3809 | /*~ This makes status_failed, status_debug etc work synchronously by |
| 3810 | * writing to REQ_FD */ |
| 3811 | status_setup_sync(REQ_FD); |
| 3812 | |
| 3813 | /*~ The very first thing we read from lightningd is our init msg */ |
| 3814 | msg = wire_sync_read(tmpctx, REQ_FD); |
| 3815 | if (fromwire_dualopend_init(state, msg, |
| 3816 | &chainparams, |
| 3817 | &state->our_features, |
| 3818 | &state->their_features, |
| 3819 | &state->tx_state->localconf, |
| 3820 | &state->max_to_self_delay, |
| 3821 | &state->min_effective_htlc_capacity, |
| 3822 | &state->our_points, |
| 3823 | &state->our_funding_pubkey, |
| 3824 | &state->minimum_depth)) { |
| 3825 | /*~ Initially we're not associated with a channel, but |
| 3826 | * handle_peer_gossip_or_error compares this. */ |
| 3827 | memset(&state->channel_id, 0, sizeof(state->channel_id)); |
| 3828 | state->channel = NULL; |
| 3829 | state->tx_state->remote_funding_sigs_rcvd = false; |
| 3830 | |
| 3831 | /*~ We set these to NULL, meaning no requirements on shutdown */ |
| 3832 | state->upfront_shutdown_script[LOCAL] |
| 3833 | = state->upfront_shutdown_script[REMOTE] |
| 3834 | = NULL; |
| 3835 | |
| 3836 | /*~ We're not locked or shutting down quite yet */ |
| 3837 | state->channel_ready[LOCAL] |
| 3838 | = state->channel_ready[REMOTE] |
| 3839 | = false; |
| 3840 | state->shutdown_sent[LOCAL] |
| 3841 | = state->shutdown_sent[REMOTE] |
| 3842 | = false; |
| 3843 | |
| 3844 | } else if (fromwire_dualopend_reinit(state, msg, |
| 3845 | &chainparams, |
| 3846 | &state->our_features, |
| 3847 | &state->their_features, |
nothing calls this directly
no test coverage detected