diff --git a/hsmd/hsm_wire.csv b/hsmd/hsm_wire.csv index 5f1a2487f..3914ecb4d 100644 --- a/hsmd/hsm_wire.csv +++ b/hsmd/hsm_wire.csv @@ -9,6 +9,7 @@ msgdata,hsmstatus_client_bad_request,msg,u8,len # Start the HSM. msgtype,hsm_init,11 msgdata,hsm_init,bip32_key_version,bip32_key_version, +msgdata,hsm_init,chain_hash,bitcoin_blkid, msgdata,hsm_init,dev_force_privkey,?privkey, msgdata,hsm_init,dev_force_bip32_seed,?secret, msgdata,hsm_init,dev_force_channel_secrets,?secrets, diff --git a/hsmd/hsmd.c b/hsmd/hsmd.c index 80def06ca..ac376f6a2 100644 --- a/hsmd/hsmd.c +++ b/hsmd/hsmd.c @@ -574,6 +574,7 @@ static struct io_plan *init_hsm(struct io_conn *conn, struct secret *seed; struct secrets *secrets; struct sha256 *shaseed; + struct bitcoin_blkid chain_hash; /* This must be lightningd. */ assert(is_lightningd(c)); @@ -582,7 +583,7 @@ static struct io_plan *init_hsm(struct io_conn *conn, * definitions in hsm_client_wire.csv. The format of those files is * an extension of the simple comma-separated format output by the * BOLT tools/extract-formats.py tool. */ - if (!fromwire_hsm_init(NULL, msg_in, &bip32_key_version, + if (!fromwire_hsm_init(NULL, msg_in, &bip32_key_version, &chain_hash, &privkey, &seed, &secrets, &shaseed)) return bad_req(conn, c, msg_in); diff --git a/lightningd/hsm_control.c b/lightningd/hsm_control.c index e7a1d2380..fd90fc90d 100644 --- a/lightningd/hsm_control.c +++ b/lightningd/hsm_control.c @@ -80,6 +80,8 @@ void hsm_init(struct lightningd *ld) { u8 *msg; int fds[2]; + struct bitcoin_blkid chainhash; + chainhash = get_chainparams(ld)->genesis_blockhash; /* We actually send requests synchronously: only status is async. */ if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds) != 0) @@ -94,7 +96,8 @@ void hsm_init(struct lightningd *ld) ld->hsm_fd = fds[0]; if (!wire_sync_write(ld->hsm_fd, towire_hsm_init(tmpctx, - &ld->topology->bitcoind->chainparams->bip32_key_version, + &ld->topology->bitcoind->chainparams->bip32_key_version, + &chainhash, #if DEVELOPER ld->dev_force_privkey, ld->dev_force_bip32_seed,