| 49 | } |
| 50 | |
| 51 | void derive_tmp_channel_id(struct channel_id *channel_id, |
| 52 | const struct pubkey *opener_basepoint) |
| 53 | { |
| 54 | struct sha256 sha; |
| 55 | |
| 56 | /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: |
| 57 | * If the peer's revocation basepoint is unknown |
| 58 | * (e.g. `open_channel2`), a temporary `channel_id` should be |
| 59 | * found by using a zeroed out basepoint for the unknown peer. |
| 60 | */ |
| 61 | u8 der_keys[PUBKEY_CMPR_LEN * 2]; |
| 62 | memset(der_keys, 0, PUBKEY_CMPR_LEN); |
| 63 | pubkey_to_der(der_keys + PUBKEY_CMPR_LEN, opener_basepoint); |
| 64 | sha256(&sha, der_keys, sizeof(der_keys)); |
| 65 | BUILD_ASSERT(sizeof(*channel_id) == sizeof(sha)); |
| 66 | memcpy(channel_id, &sha, sizeof(*channel_id)); |
| 67 | } |
| 68 | |
| 69 | /* BOLT #2: |
| 70 | * |
no test coverage detected