lightningd/opening: seed is a privkey not an sha256.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-02-24 16:22:56 +10:30
parent b8472b65ba
commit a8b9177e9e
2 changed files with 5 additions and 5 deletions

View File

@@ -64,7 +64,7 @@ struct state {
struct channel *channel; struct channel *channel;
}; };
static void derive_our_basepoints(const struct sha256 *seed, static void derive_our_basepoints(const struct privkey *seed,
struct points *points, struct points *points,
struct secrets *secrets, struct secrets *secrets,
struct sha256 *shaseed, struct sha256 *shaseed,
@@ -76,7 +76,7 @@ static void derive_our_basepoints(const struct sha256 *seed,
struct sha256 shaseed; struct sha256 shaseed;
} keys; } keys;
hkdf_sha256(&keys, sizeof(keys), NULL, 0, seed, sizeof(seed), hkdf_sha256(&keys, sizeof(keys), NULL, 0, seed, sizeof(*seed),
"c-lightning", strlen("c-lightning")); "c-lightning", strlen("c-lightning"));
secrets->funding_privkey = keys.f; secrets->funding_privkey = keys.f;
@@ -90,7 +90,7 @@ static void derive_our_basepoints(const struct sha256 *seed,
|| !pubkey_from_privkey(&keys.d, &points->delayed_payment_basepoint)) || !pubkey_from_privkey(&keys.d, &points->delayed_payment_basepoint))
status_failed(WIRE_OPENING_KEY_DERIVATION_FAILED, status_failed(WIRE_OPENING_KEY_DERIVATION_FAILED,
"seed = %s", "seed = %s",
type_to_string(trc, struct sha256, seed)); type_to_string(trc, struct privkey, seed));
/* BOLT #3: /* BOLT #3:
* *
@@ -593,7 +593,7 @@ int main(int argc, char *argv[])
{ {
u8 *msg, *peer_msg; u8 *msg, *peer_msg;
struct state *state = tal(NULL, struct state); struct state *state = tal(NULL, struct state);
struct sha256 seed; struct privkey seed;
struct points our_points; struct points our_points;
if (argc == 2 && streq(argv[1], "--version")) { if (argc == 2 && streq(argv[1], "--version")) {

View File

@@ -8,7 +8,7 @@ opening_init,36,min_config,36,struct channel_config
opening_init,72,max_config,36,struct channel_config opening_init,72,max_config,36,struct channel_config
opening_init,108,crypto_state,144,struct crypto_state opening_init,108,crypto_state,144,struct crypto_state
# Seed to generate all the keys from # Seed to generate all the keys from
opening_init,252,seed,32 opening_init,252,seed,32,struct privkey
# This means we offer the open. # This means we offer the open.
opening_open,1 opening_open,1
1 #include <lightningd/cryptomsg.h>
8 opening_init,72,max_config,36,struct channel_config
9 opening_init,108,crypto_state,144,struct crypto_state
10 # Seed to generate all the keys from
11 opening_init,252,seed,32 opening_init,252,seed,32,struct privkey
12 # This means we offer the open.
13 opening_open,1
14 opening_open,0,funding_satoshis,8