@@ -1362,15 +1362,15 @@ static u8 *handle_validate_commitment_tx(struct hsmd_client *c, const u8 *msg_in
1362
1362
if (!derive_shaseed (& channel_seed , & shaseed ))
1363
1363
return hsmd_status_bad_request (c , msg_in , "bad derive_shaseed" );
1364
1364
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 ))
1366
1366
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 );
1368
1368
1369
- if (commit_num >= 2 ) {
1369
+ if (commit_num >= 1 ) {
1370
1370
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 )) {
1372
1372
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 );
1374
1374
}
1375
1375
} else {
1376
1376
old_secret = NULL ;
0 commit comments