Skip to content

Commit b8901ac

Browse files
committed
hsmd: HSM_VERSION 6: get_per_commitment_point never returns secret
Changelog-Changed: hsmd: HSM_VERSION 6: get_per_commitment_point does not imply index - 2 is revoked, makes it safe to call on any index.
1 parent 8eae951 commit b8901ac

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

channeld/channeld.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,11 +1430,8 @@ static void start_commit_timer(struct peer *peer)
14301430
}
14311431

14321432
/* Fetch the requested point. The secret is no longer returned, use
1433-
* revoke_commitment.
1434-
*
1435-
* NOTE - Because the internals of this call also release the secret
1436-
* from a revoked commitment it is an error to call this past the next
1437-
* commitment.
1433+
* revoke_commitment. It is leagal to call this on any commitment
1434+
* (including distant future).
14381435
*/
14391436
static void get_per_commitment_point(u64 index, struct pubkey *point)
14401437
{

common/hsm_version.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
* v5 with hsmd_revoke_commitment_tx: 5742538f87ef5d5bf55b66dc19e52c8683cfeb1b887d3e64ba530ba9a4d8e638
2424
* v5 with sign_any_cannouncement: 5fdb9068c43a21887dc03f7dce410d2e3eeff6277f0d49b4fc56595a798fd4a4
2525
* v5 drop init v2: 5024454532fe5a78bb7558000cb344190888b9915360d3d56ddca22eaba9b872
26+
* v6 no secret from get_per_commitment_point: 5024454532fe5a78bb7558000cb344190888b9915360d3d56ddca22eaba9b872
2627
*/
2728
#define HSM_MIN_VERSION 5
28-
#define HSM_MAX_VERSION 5
29+
#define HSM_MAX_VERSION 6
2930
#endif /* LIGHTNING_COMMON_HSM_VERSION_H */

hsmd/hsmd_wire.csv

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,12 @@ msgdata,hsmd_sign_splice_tx,input_index,u32,
294294
msgtype,hsmd_sign_tx_reply,112
295295
msgdata,hsmd_sign_tx_reply,sig,bitcoin_signature,
296296

297-
# Openingd/channeld/onchaind asks for Nth per_commitment_point, if > 2, gets N-2 secret.
297+
# Openingd/channeld/onchaind asks for Nth per_commitment_point
298+
# Prior to HSM_VERSION 6 we will return an old_commitment_secret
298299
msgtype,hsmd_get_per_commitment_point,18
299300
msgdata,hsmd_get_per_commitment_point,n,u64,
300301

302+
# IMPORTANT - Beginning HSM_VERSION 6 we never return an old_commitment_secret
301303
msgtype,hsmd_get_per_commitment_point_reply,118
302304
msgdata,hsmd_get_per_commitment_point_reply,per_commitment_point,pubkey,
303305
msgdata,hsmd_get_per_commitment_point_reply,old_commitment_secret,?secret,

0 commit comments

Comments
 (0)