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

Function create_hsm

hsmd/hsmd.c:298–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298static void create_hsm(int fd)
299{
300 /*~ ccan/read_write_all has a more convenient return than write() where
301 * we'd have to check the return value == the length we gave: write()
302 * can return short on normal files if we run out of disk space. */
303 if (!write_all(fd, &hsm_secret, sizeof(hsm_secret))) {
304 /* ccan/noerr contains useful routines like this, which don't
305 * clobber errno, so we can use it in our error report. */
306 unlink_noerr("hsm_secret");
307 status_failed(STATUS_FAIL_INTERNAL_ERROR,
308 "writing: %s", strerror(errno));
309 }
310}
311
312/*~ We store our root secret in a "hsm_secret" file (like all of Core Lightning,
313 * we run in the user's .lightning directory). */

Callers 1

maybe_create_new_hsmFunction · 0.85

Calls 3

unlink_noerrFunction · 0.85
write_allFunction · 0.50
status_failedFunction · 0.50

Tested by

no test coverage detected