| 907 | } |
| 908 | |
| 909 | bool peer_start_openingd(struct peer *peer, struct peer_fd *peer_fd) |
| 910 | { |
| 911 | int hsmfd; |
| 912 | u32 max_to_self_delay; |
| 913 | struct amount_msat min_effective_htlc_capacity; |
| 914 | struct uncommitted_channel *uc; |
| 915 | const u8 *msg; |
| 916 | |
| 917 | assert(peer->uncommitted_channel); |
| 918 | uc = peer->uncommitted_channel; |
| 919 | assert(!uc->open_daemon); |
| 920 | |
| 921 | hsmfd = hsm_get_client_fd(peer->ld, &uc->peer->id, uc->dbid, |
| 922 | HSM_CAP_COMMITMENT_POINT |
| 923 | | HSM_CAP_SIGN_REMOTE_TX); |
| 924 | |
| 925 | uc->open_daemon = new_channel_subd(peer, peer->ld, |
| 926 | "lightning_openingd", |
| 927 | uc, &peer->id, uc->log, |
| 928 | true, openingd_wire_name, |
| 929 | openingd_msg, |
| 930 | opend_channel_errmsg, |
| 931 | opend_channel_set_billboard, |
| 932 | take(&peer_fd->fd), |
| 933 | take(&hsmfd), NULL); |
| 934 | if (!uc->open_daemon) { |
| 935 | uncommitted_channel_disconnect(uc, LOG_BROKEN, |
| 936 | tal_fmt(tmpctx, |
| 937 | "Running lightning_openingd: %s", |
| 938 | strerror(errno))); |
| 939 | tal_free(uc); |
| 940 | return false; |
| 941 | } |
| 942 | |
| 943 | channel_config(peer->ld, &uc->our_config, |
| 944 | &max_to_self_delay, |
| 945 | &min_effective_htlc_capacity); |
| 946 | |
| 947 | |
| 948 | msg = towire_openingd_init(NULL, |
| 949 | chainparams, |
| 950 | peer->ld->our_features, |
| 951 | peer->their_features, |
| 952 | &uc->our_config, |
| 953 | max_to_self_delay, |
| 954 | min_effective_htlc_capacity, |
| 955 | &uc->local_basepoints, |
| 956 | &uc->local_funding_pubkey, |
| 957 | uc->minimum_depth, |
| 958 | feerate_min(peer->ld, NULL), |
| 959 | feerate_max(peer->ld, NULL), |
| 960 | IFDEV(peer->ld->dev_force_tmp_channel_id, NULL), |
| 961 | peer->ld->config.allowdustreserve); |
| 962 | subd_send_msg(uc->open_daemon, take(msg)); |
| 963 | return true; |
| 964 | } |
| 965 | |
| 966 | static struct command_result *json_fundchannel_complete(struct command *cmd, |
no test coverage detected