Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix comments regarding breach hint and key calculations #9220

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion watchtower/lookout/lookout.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (l *Lookout) processEpoch(epoch *chainntnfs.BlockEpoch,
// The decryption key for the state update should be the full
// txid of the breaching commitment transaction.
// The decryption key for the state update should be computed as
// key = SHA256(txid).
// key = SHA256(txid || txid).
breachTxID := commitTx.TxHash()
breachKey := blob.NewBreachKeyFromHash(&breachTxID)

Expand Down
3 changes: 2 additions & 1 deletion watchtower/wtclient/backup_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ func (t *backupTask) craftSessionPayload(

breachTxID := t.breachInfo.BreachTxHash

// Compute the breach key as SHA256(txid).
// Compute the breach hint as SHA256(txid)[:16] and breach key as
// SHA256(txid || txid).
hint, key := blob.NewBreachHintAndKeyFromHash(&breachTxID)

// Then, we'll encrypt the computed justice kit using the full breach
Expand Down
2 changes: 1 addition & 1 deletion watchtower/wtclient/backup_task_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ func testBackupTask(t *testing.T, test backupTaskTest) {
hint, encBlob, err := task.craftSessionPayload(test.signer)
require.NoError(t, err, "unable to craft session payload")

// Verify that the breach hint matches the breach txid's prefix.
// Verify that the breach hint matches the prefix of SHA256(txid).
breachTxID := test.breachInfo.BreachTxHash
expHint := blob.NewBreachHintFromHash(&breachTxID)
require.Equal(t, expHint, hint)
Expand Down
Loading