Skip to content

Commit eddea3c

Browse files
committed
hsmd: make the negotiated hsmd version available to libhsmd
Changelog-None: hsmd internals
1 parent e2c88b2 commit eddea3c

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

hsmd/hsmd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ static struct io_plan *init_hsm(struct io_conn *conn,
490490
discard_key(take(hsm_encryption_key));
491491

492492
/* Define the minimum common max version for the hsmd one */
493-
u64 mutual_version = maxversion < our_maxversion ? maxversion : our_maxversion;
494-
return req_reply(conn, c, hsmd_init(hsm_secret, mutual_version,
493+
hsmd_mutual_version = maxversion < our_maxversion ? maxversion : our_maxversion;
494+
return req_reply(conn, c, hsmd_init(hsm_secret, hsmd_mutual_version,
495495
bip32_key_version));
496496
}
497497

hsmd/libhsmd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
#include <sodium/utils.h>
1717
#include <wally_psbt.h>
1818

19+
/* The negotiated protocol version ends up in here. */
20+
u64 hsmd_mutual_version;
21+
1922
/* If they specify --dev-force-privkey it ends up in here. */
2023
struct privkey *dev_force_privkey;
2124
/* If they specify --dev-force-bip32-seed it ends up in here. */

hsmd/libhsmd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ void hsmd_status_failed(enum status_failreason code,
8989
bool hsmd_check_client_capabilities(struct hsmd_client *client,
9090
enum hsmd_wire t);
9191

92+
/* The negotiated protocol version ends up in here. */
93+
extern u64 hsmd_mutual_version;
94+
9295
/* If they specify --dev-force-privkey it ends up in here. */
9396
extern struct privkey *dev_force_privkey;
9497
/* If they specify --dev-force-bip32-seed it ends up in here. */

0 commit comments

Comments
 (0)