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

Function dump_commitments_infos

tools/lightning-hsmtool.c:326–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326static 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
352static void guess_to_remote(const char *address, struct node_id *node_id,
353 u64 tries, char *hsm_secret_path)

Callers 1

mainFunction · 0.85

Calls 9

load_hsm_secretFunction · 0.85
derive_shaseedFunction · 0.85
fmt_sha256Function · 0.85
per_commit_secretFunction · 0.85
errxFunction · 0.85
tal_hexstrFunction · 0.85
per_commit_pointFunction · 0.85
fmt_pubkeyFunction · 0.85
get_channel_seedFunction · 0.70

Tested by

no test coverage detected