Send an init reply failure message to lightningd and then call status_failed */
| 290 | |
| 291 | /* Send an init reply failure message to lightningd and then call status_failed */ |
| 292 | static void hsmd_send_init_reply_failure(enum hsm_secret_error error_code, enum status_failreason reason, const char *error_msg, ...) |
| 293 | { |
| 294 | u8 *msg; |
| 295 | va_list ap; |
| 296 | char *formatted_msg; |
| 297 | |
| 298 | va_start(ap, error_msg); |
| 299 | formatted_msg = tal_vfmt(tmpctx, error_msg, ap); |
| 300 | va_end(ap); |
| 301 | |
| 302 | /* Send the init reply failure first */ |
| 303 | msg = towire_hsmd_init_reply_failure(NULL, error_code, formatted_msg); |
| 304 | if (msg) { |
| 305 | /* Send directly to lightningd via REQ_FD */ |
| 306 | wire_sync_write(REQ_FD, msg); |
| 307 | tal_free(msg); |
| 308 | } |
| 309 | |
| 310 | /* Then call status_failed with the error message */ |
| 311 | status_failed(reason, "%s", formatted_msg); |
| 312 | } |
| 313 | |
| 314 | static void create_hsm(int fd, const char *passphrase) |
| 315 | { |
no test coverage detected