| 3330 | AUTODATA(json_command, &openchannel_abort_command); |
| 3331 | |
| 3332 | bool peer_start_dualopend(struct peer *peer, |
| 3333 | struct peer_fd *peer_fd, |
| 3334 | struct channel *channel) |
| 3335 | { |
| 3336 | int hsmfd; |
| 3337 | u32 max_to_self_delay; |
| 3338 | struct amount_msat min_effective_htlc_capacity; |
| 3339 | const u8 *msg; |
| 3340 | |
| 3341 | hsmfd = hsm_get_client_fd(peer->ld, &peer->id, channel->unsaved_dbid, |
| 3342 | HSM_CAP_COMMITMENT_POINT |
| 3343 | | HSM_CAP_SIGN_REMOTE_TX |
| 3344 | | HSM_CAP_SIGN_WILL_FUND_OFFER); |
| 3345 | |
| 3346 | channel->owner = new_channel_subd(channel, |
| 3347 | peer->ld, |
| 3348 | "lightning_dualopend", |
| 3349 | channel, |
| 3350 | &peer->id, |
| 3351 | channel->log, true, |
| 3352 | dualopend_wire_name, |
| 3353 | dual_opend_msg, |
| 3354 | channel_errmsg, |
| 3355 | channel_set_billboard, |
| 3356 | take(&peer_fd->fd), |
| 3357 | take(&hsmfd), NULL); |
| 3358 | |
| 3359 | if (!channel->owner) { |
| 3360 | channel_internal_error(channel, |
| 3361 | "Running lightningd_dualopend: %s", |
| 3362 | strerror(errno)); |
| 3363 | return false; |
| 3364 | } |
| 3365 | |
| 3366 | channel_config(peer->ld, &channel->our_config, |
| 3367 | &max_to_self_delay, |
| 3368 | &min_effective_htlc_capacity); |
| 3369 | |
| 3370 | /* BOLT #2: |
| 3371 | * |
| 3372 | * The sender: |
| 3373 | * - if `channel_type` includes `option_zeroconf`: |
| 3374 | * - MUST set `minimum_depth` to zero. |
| 3375 | * - otherwise: |
| 3376 | * - SHOULD set `minimum_depth` to a number of blocks it |
| 3377 | * considers reasonable to avoid double-spending of the |
| 3378 | * funding transaction. |
| 3379 | */ |
| 3380 | /* FIXME: We should override this to 0 in the openchannel2 hook of we want zeroconf*/ |
| 3381 | channel->minimum_depth = peer->ld->config.anchor_confirms; |
| 3382 | |
| 3383 | msg = towire_dualopend_init(NULL, chainparams, |
| 3384 | peer->ld->our_features, |
| 3385 | peer->their_features, |
| 3386 | &channel->our_config, |
| 3387 | max_to_self_delay, |
| 3388 | min_effective_htlc_capacity, |
| 3389 | &channel->local_basepoints, |
no test coverage detected