If old_secret is NULL, we don't care, otherwise it is filled in. */
| 1418 | |
| 1419 | /* If old_secret is NULL, we don't care, otherwise it is filled in. */ |
| 1420 | static void get_per_commitment_point(u64 index, struct pubkey *point, |
| 1421 | struct secret *old_secret) |
| 1422 | { |
| 1423 | struct secret *s; |
| 1424 | const u8 *msg; |
| 1425 | |
| 1426 | msg = hsm_req(tmpctx, |
| 1427 | take(towire_hsmd_get_per_commitment_point(NULL, index))); |
| 1428 | |
| 1429 | if (!fromwire_hsmd_get_per_commitment_point_reply(tmpctx, msg, |
| 1430 | point, |
| 1431 | &s)) |
| 1432 | status_failed(STATUS_FAIL_HSM_IO, |
| 1433 | "Bad per_commitment_point reply %s", |
| 1434 | tal_hex(tmpctx, msg)); |
| 1435 | |
| 1436 | if (old_secret) { |
| 1437 | if (!s) |
| 1438 | status_failed(STATUS_FAIL_HSM_IO, |
| 1439 | "No secret in per_commitment_point_reply %" |
| 1440 | PRIu64, |
| 1441 | index); |
| 1442 | *old_secret = *s; |
| 1443 | } |
| 1444 | } |
| 1445 | |
| 1446 | /* revoke_index == current index - 1 (usually; not for retransmission) */ |
| 1447 | static u8 *make_revocation_msg(const struct peer *peer, u64 revoke_index, |
no test coverage detected