Browse Source

derive_basepoints: actually derive a separate HTLC key.

This means we'll find anywhere still using the payment key,
even though we still expose the private payment key to channeld.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
7ece90038b
  1. 7
      common/derive_basepoints.c

7
common/derive_basepoints.c

@ -11,7 +11,7 @@ bool derive_basepoints(const struct privkey *seed,
struct sha256 *shaseed) struct sha256 *shaseed)
{ {
struct keys { struct keys {
struct privkey f, r, p, d; struct privkey f, r, h, p, d;
struct sha256 shaseed; struct sha256 shaseed;
} keys; } keys;
@ -22,8 +22,7 @@ bool derive_basepoints(const struct privkey *seed,
secrets->funding_privkey = keys.f; secrets->funding_privkey = keys.f;
secrets->revocation_basepoint_secret = keys.r.secret; secrets->revocation_basepoint_secret = keys.r.secret;
secrets->payment_basepoint_secret = keys.p.secret; secrets->payment_basepoint_secret = keys.p.secret;
/* We currently make htlc_basepoint_secret the same */ secrets->htlc_basepoint_secret = keys.h.secret;
secrets->htlc_basepoint_secret = keys.p.secret;
secrets->delayed_payment_basepoint_secret = keys.d.secret; secrets->delayed_payment_basepoint_secret = keys.d.secret;
} }
@ -34,8 +33,8 @@ bool derive_basepoints(const struct privkey *seed,
if (basepoints) { if (basepoints) {
if (!pubkey_from_privkey(&keys.r, &basepoints->revocation) if (!pubkey_from_privkey(&keys.r, &basepoints->revocation)
|| !pubkey_from_privkey(&keys.p, &basepoints->htlc)
|| !pubkey_from_privkey(&keys.p, &basepoints->payment) || !pubkey_from_privkey(&keys.p, &basepoints->payment)
|| !pubkey_from_privkey(&keys.h, &basepoints->htlc)
|| !pubkey_from_privkey(&keys.d, &basepoints->delayed_payment)) || !pubkey_from_privkey(&keys.d, &basepoints->delayed_payment))
return false; return false;
} }

Loading…
Cancel
Save