From 1c4f6ab2c579e8decd3308f6c15febda33707b4d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 14 Mar 2023 15:46:50 +1030 Subject: [PATCH] hsmd: deprecate reply_v1. We promised two versions after v0.12, and here we are. Signed-off-by: Rusty Russell --- common/hsm_version.h | 3 ++- hsmd/hsmd.c | 1 - hsmd/hsmd_wire.csv | 7 ------- hsmd/libhsmd.c | 2 -- lightningd/hsm_control.c | 21 +++------------------ 5 files changed, 5 insertions(+), 29 deletions(-) diff --git a/common/hsm_version.h b/common/hsm_version.h index c04c407fe..63868a56f 100644 --- a/common/hsm_version.h +++ b/common/hsm_version.h @@ -9,7 +9,8 @@ * v1: 409cffa355ab6cc76bd298910adca9936a68223267ddc4815ba16aeac5d0acc3 * v2: dd89bf9323dff42200003fb864abb6608f3aa645b636fdae3ec81d804ac05196 * v3: edd3d288fc88a5470adc2f99abcbfe4d4af29fae0c7a80b4226f28810a815524 + * v3 without v1: 3f813898f7de490e9126ab817e1c9a29af79c0413d5e37068acedce3ea7b5429 */ -#define HSM_MIN_VERSION 1 +#define HSM_MIN_VERSION 2 #define HSM_MAX_VERSION 3 #endif /* LIGHTNING_COMMON_HSM_VERSION_H */ diff --git a/hsmd/hsmd.c b/hsmd/hsmd.c index 8873a3025..833725599 100644 --- a/hsmd/hsmd.c +++ b/hsmd/hsmd.c @@ -694,7 +694,6 @@ static struct io_plan *handle_client(struct io_conn *conn, struct client *c) case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY: case WIRE_HSMD_SIGN_WITHDRAWAL_REPLY: case WIRE_HSMD_SIGN_INVOICE_REPLY: - case WIRE_HSMD_INIT_REPLY_V1: case WIRE_HSMD_INIT_REPLY_V2: case WIRE_HSMD_DERIVE_SECRET_REPLY: case WIRE_HSMSTATUS_CLIENT_BAD_REQUEST: diff --git a/hsmd/hsmd_wire.csv b/hsmd/hsmd_wire.csv index b2ee907d5..05a5bc6a7 100644 --- a/hsmd/hsmd_wire.csv +++ b/hsmd/hsmd_wire.csv @@ -19,13 +19,6 @@ msgdata,hsmd_init,hsm_wire_min_version,u32, msgdata,hsmd_init,hsm_wire_max_version,u32, #include -# DEPRECATED after v0.12, remove in two versions! -msgtype,hsmd_init_reply_v1,111 -msgdata,hsmd_init_reply_v1,node_id,node_id, -msgdata,hsmd_init_reply_v1,bip32,ext_key, -msgdata,hsmd_init_reply_v1,bolt12,u8,32 -msgdata,hsmd_init_reply_v1,onion_reply_secret,secret, - msgtype,hsmd_init_reply_v2,113 msgdata,hsmd_init_reply_v2,node_id,node_id, msgdata,hsmd_init_reply_v2,bip32,ext_key, diff --git a/hsmd/libhsmd.c b/hsmd/libhsmd.c index ed11560b9..d04f7e84a 100644 --- a/hsmd/libhsmd.c +++ b/hsmd/libhsmd.c @@ -136,7 +136,6 @@ bool hsmd_check_client_capabilities(struct hsmd_client *client, case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY: case WIRE_HSMD_SIGN_WITHDRAWAL_REPLY: case WIRE_HSMD_SIGN_INVOICE_REPLY: - case WIRE_HSMD_INIT_REPLY_V1: case WIRE_HSMD_INIT_REPLY_V2: case WIRE_HSMSTATUS_CLIENT_BAD_REQUEST: case WIRE_HSMD_SIGN_COMMITMENT_TX_REPLY: @@ -1662,7 +1661,6 @@ u8 *hsmd_handle_client_message(const tal_t *ctx, struct hsmd_client *client, case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY: case WIRE_HSMD_SIGN_WITHDRAWAL_REPLY: case WIRE_HSMD_SIGN_INVOICE_REPLY: - case WIRE_HSMD_INIT_REPLY_V1: case WIRE_HSMD_INIT_REPLY_V2: case WIRE_HSMSTATUS_CLIENT_BAD_REQUEST: case WIRE_HSMD_SIGN_COMMITMENT_TX_REPLY: diff --git a/lightningd/hsm_control.c b/lightningd/hsm_control.c index de5125012..537714f83 100644 --- a/lightningd/hsm_control.c +++ b/lightningd/hsm_control.c @@ -122,24 +122,9 @@ struct ext_key *hsm_init(struct lightningd *ld) if (!fromwire_hsmd_init_reply_v2(msg, &ld->id, bip32_base, &ld->bolt12_base)) { - /* v1 had x-only pubkey */ - u8 pubkey32[33]; - /* And gave us a secret to use for onion_reply paths */ - struct secret onion_reply_secret; - - pubkey32[0] = SECP256K1_TAG_PUBKEY_EVEN; - if (!fromwire_hsmd_init_reply_v1(msg, - &ld->id, bip32_base, - pubkey32 + 1, - &onion_reply_secret)) { - if (ld->config.keypass) - errx(EXITCODE_HSM_BAD_PASSWORD, "Wrong password for encrypted hsm_secret."); - errx(EXITCODE_HSM_GENERIC_ERROR, "HSM did not give init reply"); - } - if (!pubkey_from_der(pubkey32, sizeof(pubkey32), - &ld->bolt12_base)) - errx(EXITCODE_HSM_GENERIC_ERROR, - "HSM gave invalid v1 bolt12_base"); + if (ld->config.keypass) + errx(EXITCODE_HSM_BAD_PASSWORD, "Wrong password for encrypted hsm_secret."); + errx(EXITCODE_HSM_GENERIC_ERROR, "HSM did not give init reply"); } /* This is equivalent to makesecret("bolt12-invoice-base") */