Skip to content

Commit 2064982

Browse files
vincenzopalazzocdecker
authored andcommitted
lightningd: do not abort while parsing hsm pwd.
This is a mistake that I introduced while I implemented the lightningd custom error for hsmd. In particular, when the command line parser check if the file is encrypted make an additional check regarding the existence of the file. This can be a not useful check, but due to the delicate nature of the hsm file, it is better to check if exist and if it doesn't exist an informative line inside the log is emitted that notifies the user that the file does not exist. This log may return useful while debugging disaster (that can happen) to understand that there is something strange (eg. the user moves the hsm file somewhere else). Fixes #5719 Changelog-Fixed: lightningd: do not abort while parsing hsm pwd Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent dbb38e2 commit 2064982

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lightningd/options.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,15 @@ static char *opt_set_hsm_password(struct lightningd *ld)
516516
int is_encrypted;
517517

518518
is_encrypted = is_hsm_secret_encrypted("hsm_secret");
519+
/* While lightningd is performing the first initialization
520+
* this check is always true because the file does not exist.
521+
*
522+
* Maybe the is_hsm_secret_encrypted is performing a not useful
523+
* check at this stage, but the hsm is a delicate part,
524+
* so it is a good information to have inside the log. */
519525
if (is_encrypted == -1)
520-
return tal_fmt(NULL, "Could not access 'hsm_secret': %s",
521-
strerror(errno));
526+
log_info(ld->log, "'hsm_secret' does not exist (%s)",
527+
strerror(errno));
522528

523529
prompt(ld, "The hsm_secret is encrypted with a password. In order to "
524530
"decrypt it and start the node you must provide the password.");

0 commit comments

Comments
 (0)