~ This returns the secret and/or public x-only key for this node. */
| 223 | |
| 224 | /*~ This returns the secret and/or public x-only key for this node. */ |
| 225 | static 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. */ |
no test coverage detected