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

Function node_schnorrkey

hsmd/libhsmd.c:225–247  ·  view source on GitHub ↗

~ This returns the secret and/or public x-only key for this node. */

Source from the content-addressed store, hash-verified

223
224/*~ This returns the secret and/or public x-only key for this node. */
225static void node_schnorrkey(secp256k1_keypair *node_keypair,
226 struct point32 *node_id32)
227{
228 secp256k1_keypair unused_kp;
229 struct privkey node_privkey;
230
231 if (!node_keypair)
232 node_keypair = &unused_kp;
233
234 node_key(&node_privkey, NULL);
235 if (secp256k1_keypair_create(secp256k1_ctx, node_keypair,
236 node_privkey.secret.data) != 1)
237 hsmd_status_failed(STATUS_FAIL_INTERNAL_ERROR,
238 "Failed to derive keypair");
239
240 if (node_id32) {
241 if (secp256k1_keypair_xonly_pub(secp256k1_ctx,
242 &node_id32->pubkey,
243 NULL, node_keypair) != 1)
244 hsmd_status_failed(STATUS_FAIL_INTERNAL_ERROR,
245 "Failed to derive xonly pub");
246 }
247}
248
249/*~ This secret is the basis for all per-channel secrets: the per-channel seeds
250 * will be generated by mixing in the dbid and the peer node_id. */

Callers 1

handle_sign_bolt12Function · 0.85

Calls 2

node_keyFunction · 0.85
hsmd_status_failedFunction · 0.70

Tested by

no test coverage detected