@@ -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