diff --git a/hsmd/hsm.c b/hsmd/hsm.c index 8b8640f87..9a1917927 100644 --- a/hsmd/hsm.c +++ b/hsmd/hsm.c @@ -498,27 +498,6 @@ static void pass_client_hsmfd(struct daemon_conn *master, const u8 *msg) daemon_conn_send_fd(master, fds[1]); } - -static void pass_hsmfd_ecdh(struct daemon_conn *master, const u8 *msg) -{ - int fds[2]; - struct pubkey id; - - if (!fromwire_hsmctl_hsmfd_ecdh(msg, NULL)) - master_badmsg(WIRE_HSMCTL_HSMFD_ECDH, msg); - - if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) != 0) - status_failed(STATUS_FAIL_INTERNAL_ERROR, - "creating fds: %s", strerror(errno)); - - /* This is gossipd, so we use our own id */ - node_key(NULL, &id); - new_client(master, &id, HSM_CAP_ECDH, handle_ecdh, fds[0]); - daemon_conn_send(master, - take(towire_hsmctl_hsmfd_ecdh_fd_reply(master))); - daemon_conn_send_fd(master, fds[1]); -} - /* Reply to an incoming request for an HSMFD for a channeld. */ static void pass_hsmfd_channeld(struct daemon_conn *master, const u8 *msg) { @@ -745,9 +724,6 @@ static struct io_plan *control_received_req(struct io_conn *conn, case WIRE_HSMCTL_CLIENT_HSMFD: pass_client_hsmfd(master, master->msg_in); return daemon_conn_read_next(conn, master); - case WIRE_HSMCTL_HSMFD_ECDH: - pass_hsmfd_ecdh(master, master->msg_in); - return daemon_conn_read_next(conn, master); case WIRE_HSMCTL_HSMFD_CHANNELD: pass_hsmfd_channeld(master, master->msg_in); return daemon_conn_read_next(conn, master); @@ -769,7 +745,6 @@ static struct io_plan *control_received_req(struct io_conn *conn, case WIRE_HSMCTL_INIT_REPLY: case WIRE_HSMCTL_CLIENT_HSMFD_REPLY: - case WIRE_HSMCTL_HSMFD_ECDH_FD_REPLY: case WIRE_HSMCTL_HSMFD_CHANNELD_REPLY: case WIRE_HSMCTL_SIGN_FUNDING_REPLY: case WIRE_HSMCTL_SIGN_WITHDRAWAL_REPLY: diff --git a/hsmd/hsm_wire.csv b/hsmd/hsm_wire.csv index c3f03a6bd..39a574027 100644 --- a/hsmd/hsm_wire.csv +++ b/hsmd/hsm_wire.csv @@ -22,12 +22,6 @@ hsmctl_client_hsmfd,,capabilities,u64 # No content, just an fd. hsmctl_client_hsmfd_reply,109 -# ECDH returns an fd (for gossipd to do handshake) -hsmctl_hsmfd_ecdh,3 - -# No contents, just an fd. -hsmctl_hsmfd_ecdh_fd_reply,103 - # Return signature for a funding tx. #include # FIXME: This should also take their commit sig & details, to verify. @@ -44,7 +38,7 @@ hsmctl_sign_funding_reply,104 hsmctl_sign_funding_reply,,num_sigs,u16 hsmctl_sign_funding_reply,,sig,num_sigs*secp256k1_ecdsa_signature -# Request a client socket for a `channeld`, allows signing announcements +# Request a client socket for a `channeld`, allows signing announcements hsmctl_hsmfd_channeld,5 hsmctl_hsmfd_channeld,,id,struct pubkey diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 95830efe8..5f2a67ba8 100644 --- a/lightningd/gossip_control.c +++ b/lightningd/gossip_control.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -101,13 +102,14 @@ void gossip_init(struct lightningd *ld) tal_t *tmpctx = tal_tmpctx(ld); u8 *msg; int hsmfd; + u64 capabilities = HSM_CAP_ECDH | HSM_CAP_SIGN_GOSSIP; - msg = towire_hsmctl_hsmfd_ecdh(tmpctx); + msg = towire_hsmctl_client_hsmfd(tmpctx, &ld->id, capabilities); if (!wire_sync_write(ld->hsm_fd, msg)) fatal("Could not write to HSM: %s", strerror(errno)); msg = hsm_sync_read(tmpctx, ld); - if (!fromwire_hsmctl_hsmfd_ecdh_fd_reply(msg, NULL)) + if (!fromwire_hsmctl_client_hsmfd_reply(msg, NULL)) fatal("Malformed hsmfd response: %s", tal_hex(msg, msg)); hsmfd = fdpass_recv(ld->hsm_fd);