MCPcopy Create free account
hub / github.com/ElementsProject/lightning / derive_keys

Function derive_keys

common/derive_basepoints.c:46–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44};
45
46static void derive_keys(const struct secret *seed, struct keys *keys)
47{
48 hkdf_sha256(keys, sizeof(*keys), NULL, 0, seed, sizeof(*seed),
49 "c-lightning", strlen("c-lightning"));
50
51#if DEVELOPER
52 if (dev_force_channel_secrets) {
53 keys->f = dev_force_channel_secrets->funding_privkey;
54 keys->r.secret = dev_force_channel_secrets->revocation_basepoint_secret;
55 keys->p.secret = dev_force_channel_secrets->payment_basepoint_secret;
56 keys->h.secret = dev_force_channel_secrets->htlc_basepoint_secret;
57 keys->d.secret = dev_force_channel_secrets->delayed_payment_basepoint_secret;
58 }
59 if (dev_force_channel_secrets_shaseed)
60 keys->shaseed = *dev_force_channel_secrets_shaseed;
61#endif
62}
63
64bool derive_basepoints(const struct secret *seed,
65 struct pubkey *funding_pubkey,

Callers 7

derive_basepointsFunction · 0.70
derive_payment_basepointFunction · 0.70
derive_shaseedFunction · 0.70
derive_funding_keyFunction · 0.70
derive_htlc_basepointFunction · 0.70

Calls 1

hkdf_sha256Function · 0.85

Tested by

no test coverage detected