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

Function derive_tmp_channel_id

common/channel_id.c:57–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57void derive_tmp_channel_id(struct channel_id *channel_id,
58 const struct pubkey *opener_basepoint)
59{
60 struct sha256 sha;
61
62 /* BOLT #2:
63 * When sending `open_channel2`, the peer's revocation basepoint is unknown.
64 * A `temporary_channel_id` must be computed by using a zeroed out basepoint
65 * for the non-initiator.
66 */
67 u8 der_keys[PUBKEY_CMPR_LEN * 2];
68 memset(der_keys, 0, PUBKEY_CMPR_LEN);
69 pubkey_to_der(der_keys + PUBKEY_CMPR_LEN, opener_basepoint);
70 sha256(&sha, der_keys, sizeof(der_keys));
71 CROSS_TYPE_ASSIGNMENT(channel_id, &sha);
72}
73
74/* BOLT #2:
75 *

Callers 4

openchannel_initFunction · 0.85
json_queryratesFunction · 0.85
accepter_startFunction · 0.85
opener_startFunction · 0.85

Calls 2

pubkey_to_derFunction · 0.85
sha256Class · 0.70

Tested by

no test coverage detected