hsmd: increase HSM_MAX_VERSION to 3

This commit is contained in:
Ken Sedgwick 2022-12-13 16:19:49 -08:00 committed by Alex Myers
parent a4dc714cdc
commit 7b2c5617c1
3 changed files with 5 additions and 4 deletions

View File

@ -11,7 +11,7 @@
#define HSM_MIN_VERSION 1 #define HSM_MIN_VERSION 1
/* wire/hsmd_wire.csv contents version: /* wire/hsmd_wire.csv contents version:
* dd89bf9323dff42200003fb864abb6608f3aa645b636fdae3ec81d804ac05196 * edd3d288fc88a5470adc2f99abcbfe4d4af29fae0c7a80b4226f28810a815524
*/ */
#define HSM_MAX_VERSION 2 #define HSM_MAX_VERSION 3
#endif /* LIGHTNING_COMMON_HSM_VERSION_H */ #endif /* LIGHTNING_COMMON_HSM_VERSION_H */

View File

@ -444,7 +444,7 @@ static struct io_plan *init_hsm(struct io_conn *conn,
struct secret *hsm_encryption_key; struct secret *hsm_encryption_key;
struct bip32_key_version bip32_key_version; struct bip32_key_version bip32_key_version;
u32 minversion, maxversion; u32 minversion, maxversion;
const u32 our_minversion = 2, our_maxversion = 2; const u32 our_minversion = 2, our_maxversion = 3;
/* This must be lightningd. */ /* This must be lightningd. */
assert(is_lightningd(c)); assert(is_lightningd(c));

View File

@ -104,6 +104,7 @@ struct ext_key *hsm_init(struct lightningd *ld)
} }
ld->hsm_fd = fds[0]; ld->hsm_fd = fds[0];
u32 min_version = 3; /* payment modifiers need hsmd_preapprove_{invoice,keysend} */
if (!wire_sync_write(ld->hsm_fd, towire_hsmd_init(tmpctx, if (!wire_sync_write(ld->hsm_fd, towire_hsmd_init(tmpctx,
&chainparams->bip32_key_version, &chainparams->bip32_key_version,
chainparams, chainparams,
@ -112,7 +113,7 @@ struct ext_key *hsm_init(struct lightningd *ld)
IFDEV(ld->dev_force_bip32_seed, NULL), IFDEV(ld->dev_force_bip32_seed, NULL),
IFDEV(ld->dev_force_channel_secrets, NULL), IFDEV(ld->dev_force_channel_secrets, NULL),
IFDEV(ld->dev_force_channel_secrets_shaseed, NULL), IFDEV(ld->dev_force_channel_secrets_shaseed, NULL),
HSM_MIN_VERSION, min_version,
HSM_MAX_VERSION))) HSM_MAX_VERSION)))
err(EXITCODE_HSM_GENERIC_ERROR, "Writing init msg to hsm"); err(EXITCODE_HSM_GENERIC_ERROR, "Writing init msg to hsm");