From 37fe32aa17ebfe88026d56a2da33a9883d860d12 Mon Sep 17 00:00:00 2001 From: Ken Sedgwick Date: Fri, 15 Mar 2024 14:16:02 -0700 Subject: [PATCH] hsmd: make the negotiated hsmd version available to libhsmd Changelog-None: hsmd internals --- hsmd/hsmd.c | 4 ++-- hsmd/libhsmd.c | 3 +++ hsmd/libhsmd.h | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hsmd/hsmd.c b/hsmd/hsmd.c index c8ddd5dff..52c550f98 100644 --- a/hsmd/hsmd.c +++ b/hsmd/hsmd.c @@ -511,8 +511,8 @@ static struct io_plan *init_hsm(struct io_conn *conn, discard_key(take(hsm_encryption_key)); /* Define the minimum common max version for the hsmd one */ - u64 mutual_version = maxversion < our_maxversion ? maxversion : our_maxversion; - return req_reply(conn, c, hsmd_init(hsm_secret, mutual_version, + hsmd_mutual_version = maxversion < our_maxversion ? maxversion : our_maxversion; + return req_reply(conn, c, hsmd_init(hsm_secret, hsmd_mutual_version, bip32_key_version)); } diff --git a/hsmd/libhsmd.c b/hsmd/libhsmd.c index 47b0698e6..73c5c79f9 100644 --- a/hsmd/libhsmd.c +++ b/hsmd/libhsmd.c @@ -15,6 +15,9 @@ #include #include +/* The negotiated protocol version ends up in here. */ +u64 hsmd_mutual_version; + /* If they specify --dev-force-privkey it ends up in here. */ struct privkey *dev_force_privkey; /* If they specify --dev-force-bip32-seed it ends up in here. */ diff --git a/hsmd/libhsmd.h b/hsmd/libhsmd.h index 79e9b9e2d..33a6dfadc 100644 --- a/hsmd/libhsmd.h +++ b/hsmd/libhsmd.h @@ -89,6 +89,9 @@ void hsmd_status_failed(enum status_failreason code, bool hsmd_check_client_capabilities(struct hsmd_client *client, enum hsmd_wire t); +/* The negotiated protocol version ends up in here. */ +extern u64 hsmd_mutual_version; + /* If they specify --dev-force-privkey it ends up in here. */ extern struct privkey *dev_force_privkey; /* If they specify --dev-force-bip32-seed it ends up in here. */