Skip to content

Commit 0484417

Browse files
committed
fixed bug in internal hsmd impl of validate_commitment_tx
1 parent 29d7710 commit 0484417

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

hsmd/libhsmd.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,15 +1362,15 @@ static u8 *handle_validate_commitment_tx(struct hsmd_client *c, const u8 *msg_in
13621362
if (!derive_shaseed(&channel_seed, &shaseed))
13631363
return hsmd_status_bad_request(c, msg_in, "bad derive_shaseed");
13641364

1365-
if (!per_commit_point(&shaseed, &next_per_commitment_point, commit_num))
1365+
if (!per_commit_point(&shaseed, &next_per_commitment_point, commit_num + 1))
13661366
return hsmd_status_bad_request_fmt(
1367-
c, msg_in, "bad per_commit_point %" PRIu64, commit_num);
1367+
c, msg_in, "bad per_commit_point %" PRIu64, commit_num + 1);
13681368

1369-
if (commit_num >= 2) {
1369+
if (commit_num >= 1) {
13701370
old_secret = tal(tmpctx, struct secret);
1371-
if (!per_commit_secret(&shaseed, old_secret, commit_num - 2)) {
1371+
if (!per_commit_secret(&shaseed, old_secret, commit_num - 1)) {
13721372
return hsmd_status_bad_request_fmt(
1373-
c, msg_in, "Cannot derive secret %" PRIu64, commit_num - 2);
1373+
c, msg_in, "Cannot derive secret %" PRIu64, commit_num - 1);
13741374
}
13751375
} else {
13761376
old_secret = NULL;

0 commit comments

Comments
 (0)