| 317 | } |
| 318 | |
| 319 | static struct state *fromwire_new_state(const tal_t *ctx) |
| 320 | { |
| 321 | struct state *state = talz(ctx, struct state); |
| 322 | |
| 323 | state->pps = new_per_peer_state(state); |
| 324 | per_peer_state_set_fd(state->pps, PEER_FD); |
| 325 | |
| 326 | if (!fromwire_channel_id(cursor, max, &state->channel_id)) |
| 327 | return NULL; |
| 328 | |
| 329 | state->first_per_commitment_point[LOCAL] |
| 330 | = state->first_per_commitment_point[REMOTE] |
| 331 | = dummy_pubkey; |
| 332 | |
| 333 | /* We set these to NULL, meaning no requirements on shutdown */ |
| 334 | state->upfront_shutdown_script[LOCAL] |
| 335 | = state->upfront_shutdown_script[REMOTE] |
| 336 | = NULL; |
| 337 | |
| 338 | /* This is almost a reiteration of fromwire_openingd_init() */ |
| 339 | state->our_features = fromwire_feature_set(ctx, cursor, max); |
| 340 | u8 their_init_features_len = fromwire_u8(cursor, max); |
| 341 | state->their_features = their_init_features_len ? tal_arr(ctx, u8, their_init_features_len) : NULL; |
| 342 | fromwire_u8_array(cursor, max, state->their_features, their_init_features_len); |
| 343 | fromwire_channel_config(cursor, max, &state->localconf); |
| 344 | state->max_to_self_delay = fromwire_u32(cursor, max); |
| 345 | state->min_effective_htlc_capacity = fromwire_amount_msat(cursor, max); |
| 346 | fromwire_basepoints(cursor, max, &state->our_points); |
| 347 | state->minimum_depth = fromwire_u32(cursor, max); |
| 348 | state->min_feerate = fromwire_u32(cursor, max); |
| 349 | state->max_feerate = fromwire_u32(cursor, max); |
| 350 | state->our_funding_pubkey = dummy_pubkey; |
| 351 | |
| 352 | /* Set developer options to false. */ |
| 353 | state->developer = false; |
| 354 | state->allowdustreserve = false; |
| 355 | state->dev_accept_any_channel_type = false; |
| 356 | state->dev_force_tmp_channel_id = NULL; |
| 357 | |
| 358 | /* The default value for CLN. */ |
| 359 | state->localconf.dust_limit = amount_sat(546); |
| 360 | |
| 361 | return state; |
| 362 | } |
| 363 | |
| 364 | static u8 *create_open_channel_msg(const tal_t *ctx, struct state *state) |
| 365 | { |
no test coverage detected