From a8b9177e9e51edacfb26a70971982aa0b6fd9301 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 24 Feb 2017 16:22:56 +1030 Subject: [PATCH] lightningd/opening: seed is a privkey not an sha256. Signed-off-by: Rusty Russell --- lightningd/opening/opening.c | 8 ++++---- lightningd/opening/opening_control_wire.csv | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lightningd/opening/opening.c b/lightningd/opening/opening.c index 0c53944ac..7725a2d84 100644 --- a/lightningd/opening/opening.c +++ b/lightningd/opening/opening.c @@ -64,7 +64,7 @@ struct state { 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 secrets *secrets, struct sha256 *shaseed, @@ -76,7 +76,7 @@ static void derive_our_basepoints(const struct sha256 *seed, struct sha256 shaseed; } 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")); 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)) status_failed(WIRE_OPENING_KEY_DERIVATION_FAILED, "seed = %s", - type_to_string(trc, struct sha256, seed)); + type_to_string(trc, struct privkey, seed)); /* BOLT #3: * @@ -593,7 +593,7 @@ int main(int argc, char *argv[]) { u8 *msg, *peer_msg; struct state *state = tal(NULL, struct state); - struct sha256 seed; + struct privkey seed; struct points our_points; if (argc == 2 && streq(argv[1], "--version")) { diff --git a/lightningd/opening/opening_control_wire.csv b/lightningd/opening/opening_control_wire.csv index 506a63b41..7fdff169e 100644 --- a/lightningd/opening/opening_control_wire.csv +++ b/lightningd/opening/opening_control_wire.csv @@ -8,7 +8,7 @@ opening_init,36,min_config,36,struct channel_config opening_init,72,max_config,36,struct channel_config opening_init,108,crypto_state,144,struct crypto_state # 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. opening_open,1