Send an init reply failure message to lightningd and then call status_failed */
| 279 | |
| 280 | /* Send an init reply failure message to lightningd and then call status_failed */ |
| 281 | static void hsmd_send_init_reply_failure(enum hsm_secret_error error_code, enum status_failreason reason, const char *error_msg, ...) |
| 282 | { |
| 283 | u8 *msg; |
| 284 | va_list ap; |
| 285 | char *formatted_msg; |
| 286 | |
| 287 | va_start(ap, error_msg); |
| 288 | formatted_msg = tal_vfmt(tmpctx, error_msg, ap); |
| 289 | va_end(ap); |
| 290 | |
| 291 | /* Send the init reply failure first */ |
| 292 | msg = towire_hsmd_init_reply_failure(NULL, error_code, formatted_msg); |
| 293 | if (msg) { |
| 294 | /* Send directly to lightningd via REQ_FD */ |
| 295 | wire_sync_write(REQ_FD, msg); |
| 296 | tal_free(msg); |
| 297 | } |
| 298 | |
| 299 | /* Then call status_failed with the error message */ |
| 300 | status_failed(reason, "%s", formatted_msg); |
| 301 | } |
| 302 | |
| 303 | static void create_hsm(int fd, const char *passphrase) |
| 304 | { |
no test coverage detected