| 324 | } |
| 325 | |
| 326 | static void dump_commitments_infos(struct node_id *node_id, u64 channel_id, |
| 327 | u64 depth, char *hsm_secret_path) |
| 328 | { |
| 329 | struct sha256 shaseed; |
| 330 | struct secret hsm_secret, channel_seed, per_commitment_secret; |
| 331 | struct pubkey per_commitment_point; |
| 332 | struct hsm_secret *hsms = load_hsm_secret(tmpctx, hsm_secret_path); |
| 333 | /* Extract first 32 bytes for legacy compatibility */ |
| 334 | memcpy(hsm_secret.data, hsms->secret_data, 32); |
| 335 | get_channel_seed(&channel_seed, node_id, channel_id, &hsm_secret); |
| 336 | |
| 337 | derive_shaseed(&channel_seed, &shaseed); |
| 338 | printf("shaseed: %s\n", fmt_sha256(tmpctx, &shaseed)); |
| 339 | for (u64 i = 0; i < depth; i++) { |
| 340 | if (!per_commit_secret(&shaseed, &per_commitment_secret, i)) |
| 341 | errx(ERROR_KEYDERIV, "Could not derive secret #%"PRIu64, i); |
| 342 | printf("commit secret #%"PRIu64": %s\n", |
| 343 | i, tal_hexstr(tmpctx, per_commitment_secret.data, |
| 344 | sizeof(per_commitment_secret.data))); |
| 345 | if (!per_commit_point(&shaseed, &per_commitment_point, i)) |
| 346 | errx(ERROR_KEYDERIV, "Could not derive point #%"PRIu64, i); |
| 347 | printf("commit point #%"PRIu64": %s\n", |
| 348 | i, fmt_pubkey(tmpctx, &per_commitment_point)); |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | static void guess_to_remote(const char *address, struct node_id *node_id, |
| 353 | u64 tries, char *hsm_secret_path) |
no test coverage detected