mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
hsmd: Tell hsmd which chain we are working on
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
15e73e3dc3
commit
c5ac6c7b1f
@ -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,
|
||||
|
|
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user