mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 07:34:21 +01:00
lightningd: use hsm_get_client_fd() helper for global daemons too.
We couldn't use it before because it asserted dbid was non-zero. Remove assert and save some code. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Header from folded patch 'fixup!_lightningd__use_hsm_get_client_fd()_helper_for_global_daemons_too.patch': fixup! lightningd: use hsm_get_client_fd() helper for global daemons too. Suggested-by: @ZmnSCPxj
This commit is contained in:
committed by
Christian Decker
parent
cc48e794c9
commit
04c77f4853
@@ -14,6 +14,7 @@
|
||||
#include <hsmd/gen_hsm_wire.h>
|
||||
#include <lightningd/channel.h>
|
||||
#include <lightningd/connect_control.h>
|
||||
#include <lightningd/hsm_control.h>
|
||||
#include <lightningd/json.h>
|
||||
#include <lightningd/jsonrpc.h>
|
||||
#include <lightningd/jsonrpc_errors.h>
|
||||
@@ -333,7 +334,6 @@ int connectd_init(struct lightningd *ld)
|
||||
int fds[2];
|
||||
u8 *msg;
|
||||
int hsmfd;
|
||||
u64 capabilities = HSM_CAP_ECDH;
|
||||
struct wireaddr_internal *wireaddrs = ld->proposed_wireaddr;
|
||||
enum addr_listen_announce *listen_announce = ld->proposed_listen_announce;
|
||||
bool allow_localhost = false;
|
||||
@@ -345,17 +345,7 @@ int connectd_init(struct lightningd *ld)
|
||||
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds) != 0)
|
||||
fatal("Could not socketpair for connectd<->gossipd");
|
||||
|
||||
msg = towire_hsm_client_hsmfd(tmpctx, &ld->id, 0, capabilities);
|
||||
if (!wire_sync_write(ld->hsm_fd, msg))
|
||||
fatal("Could not write to HSM: %s", strerror(errno));
|
||||
|
||||
msg = wire_sync_read(tmpctx, ld->hsm_fd);
|
||||
if (!fromwire_hsm_client_hsmfd_reply(msg))
|
||||
fatal("Malformed hsmfd response: %s", tal_hex(msg, msg));
|
||||
|
||||
hsmfd = fdpass_recv(ld->hsm_fd);
|
||||
if (hsmfd < 0)
|
||||
fatal("Could not read fd from HSM: %s", strerror(errno));
|
||||
hsmfd = hsm_get_global_fd(ld, HSM_CAP_ECDH);
|
||||
|
||||
ld->connectd = new_global_subd(ld, "lightning_connectd",
|
||||
connect_wire_type_name, connectd_msg,
|
||||
|
||||
Reference in New Issue
Block a user