@@ -1370,15 +1370,15 @@ static u8 *handle_validate_commitment_tx(struct hsmd_client *c, const u8 *msg_in
13701370 if (!derive_shaseed (& channel_seed , & shaseed ))
13711371 return hsmd_status_bad_request (c , msg_in , "bad derive_shaseed" );
13721372
1373- if (!per_commit_point (& shaseed , & next_per_commitment_point , commit_num ))
1373+ if (!per_commit_point (& shaseed , & next_per_commitment_point , commit_num + 1 ))
13741374 return hsmd_status_bad_request_fmt (
1375- c , msg_in , "bad per_commit_point %" PRIu64 , commit_num );
1375+ c , msg_in , "bad per_commit_point %" PRIu64 , commit_num + 1 );
13761376
1377- if (commit_num >= 2 ) {
1377+ if (commit_num >= 1 ) {
13781378 old_secret = tal (tmpctx , struct secret );
1379- if (!per_commit_secret (& shaseed , old_secret , commit_num - 2 )) {
1379+ if (!per_commit_secret (& shaseed , old_secret , commit_num - 1 )) {
13801380 return hsmd_status_bad_request_fmt (
1381- c , msg_in , "Cannot derive secret %" PRIu64 , commit_num - 2 );
1381+ c , msg_in , "Cannot derive secret %" PRIu64 , commit_num - 1 );
13821382 }
13831383 } else {
13841384 old_secret = NULL ;
0 commit comments