MCPcopy Create free account
hub / github.com/ElementsProject/lightning / hsm_get_fd

Function hsm_get_fd

lightningd/hsm_control.c:22–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#include <wire/wire_sync.h>
21
22static int hsm_get_fd(struct lightningd *ld,
23 const struct node_id *id,
24 u64 dbid,
25 int capabilities)
26{
27 int hsm_fd;
28 u8 *msg;
29
30 msg = towire_hsmd_client_hsmfd(NULL, id, dbid, capabilities);
31 if (!wire_sync_write(ld->hsm_fd, take(msg)))
32 fatal("Could not write to HSM: %s", strerror(errno));
33
34 msg = wire_sync_read(tmpctx, ld->hsm_fd);
35 if (!fromwire_hsmd_client_hsmfd_reply(msg))
36 fatal("Bad reply from HSM: %s", tal_hex(tmpctx, msg));
37
38 hsm_fd = fdpass_recv(ld->hsm_fd);
39 if (hsm_fd < 0)
40 fatal("Could not read fd from HSM: %s", strerror(errno));
41 return hsm_fd;
42}
43
44int hsm_get_client_fd(struct lightningd *ld,
45 const struct node_id *id,

Callers 2

hsm_get_client_fdFunction · 0.85
hsm_get_global_fdFunction · 0.85

Calls 5

tal_hexFunction · 0.85
fdpass_recvFunction · 0.85
fatalFunction · 0.70
wire_sync_writeFunction · 0.50
wire_sync_readFunction · 0.50

Tested by

no test coverage detected