| 4328 | } |
| 4329 | |
| 4330 | int main(int argc, char *argv[]) |
| 4331 | { |
| 4332 | setup_locale(); |
| 4333 | |
| 4334 | struct pollfd pollfd[2]; |
| 4335 | struct state *state = tal(NULL, struct state); |
| 4336 | struct fee_states *fee_states; |
| 4337 | enum side opener; |
| 4338 | u8 *msg; |
| 4339 | struct amount_sat total_funding, *requested_lease; |
| 4340 | struct amount_msat our_msat; |
| 4341 | bool from_abort; |
| 4342 | |
| 4343 | state->developer = subdaemon_setup(argc, argv); |
| 4344 | |
| 4345 | /* Init the holder for the funding transaction attempt */ |
| 4346 | state->tx_state = new_tx_state(state); |
| 4347 | |
| 4348 | /*~ This makes status_failed, status_debug etc work synchronously by |
| 4349 | * writing to REQ_FD */ |
| 4350 | status_setup_sync(REQ_FD); |
| 4351 | |
| 4352 | /* Init state to not aborted */ |
| 4353 | state->aborted_err = NULL; |
| 4354 | |
| 4355 | /*~ The very first thing we read from lightningd is our init msg */ |
| 4356 | msg = wire_sync_read(tmpctx, REQ_FD); |
| 4357 | if (fromwire_dualopend_init(state, msg, |
| 4358 | &chainparams, |
| 4359 | &state->our_features, |
| 4360 | &state->their_features, |
| 4361 | &state->tx_state->localconf, |
| 4362 | &state->max_to_self_delay, |
| 4363 | &state->min_effective_htlc_capacity, |
| 4364 | &state->our_points, |
| 4365 | &state->our_funding_pubkey, |
| 4366 | &state->minimum_depth, |
| 4367 | &state->require_confirmed_inputs[LOCAL], |
| 4368 | &state->local_alias, |
| 4369 | &state->dev_accept_any_channel_type)) { |
| 4370 | /*~ Initially we're not associated with a channel, but |
| 4371 | * handle_peer_gossip_or_error compares this. */ |
| 4372 | memset(&state->channel_id, 0, sizeof(state->channel_id)); |
| 4373 | from_abort = false; |
| 4374 | state->channel = NULL; |
| 4375 | state->tx_state->remote_funding_sigs_rcvd = false; |
| 4376 | |
| 4377 | /*~ We set these to NULL, meaning no requirements on shutdown */ |
| 4378 | state->upfront_shutdown_script[LOCAL] |
| 4379 | = state->upfront_shutdown_script[REMOTE] |
| 4380 | = NULL; |
| 4381 | |
| 4382 | /*~ We're not locked or shutting down quite yet */ |
| 4383 | state->channel_ready[LOCAL] |
| 4384 | = state->channel_ready[REMOTE] |
| 4385 | = false; |
| 4386 | state->shutdown_sent[LOCAL] |
| 4387 | = state->shutdown_sent[REMOTE] |
nothing calls this directly
no test coverage detected