mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
hsmd: deprecate reply_v1.
We promised two versions after v0.12, and here we are. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
fd04f46a92
commit
1c4f6ab2c5
5 changed files with 5 additions and 29 deletions
|
@ -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 */
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -19,13 +19,6 @@ msgdata,hsmd_init,hsm_wire_min_version,u32,
|
|||
msgdata,hsmd_init,hsm_wire_max_version,u32,
|
||||
|
||||
#include <common/bip32.h>
|
||||
# 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,
|
||||
|
|
|
|
@ -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:
|
||||
|
|
|
@ -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") */
|
||||
|
|
Loading…
Add table
Reference in a new issue