mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-01 11:00:51 +02:00
Merge pull request #9220 from oren-z0/issue-9169-code-comments-fix
Fix comments regarding breach hint and key calculations
This commit is contained in:
@ -203,7 +203,7 @@ func (l *Lookout) processEpoch(epoch *chainntnfs.BlockEpoch,
|
|||||||
// The decryption key for the state update should be the full
|
// The decryption key for the state update should be the full
|
||||||
// txid of the breaching commitment transaction.
|
// txid of the breaching commitment transaction.
|
||||||
// The decryption key for the state update should be computed as
|
// The decryption key for the state update should be computed as
|
||||||
// key = SHA256(txid).
|
// key = SHA256(txid || txid).
|
||||||
breachTxID := commitTx.TxHash()
|
breachTxID := commitTx.TxHash()
|
||||||
breachKey := blob.NewBreachKeyFromHash(&breachTxID)
|
breachKey := blob.NewBreachKeyFromHash(&breachTxID)
|
||||||
|
|
||||||
|
@ -339,7 +339,8 @@ func (t *backupTask) craftSessionPayload(
|
|||||||
|
|
||||||
breachTxID := t.breachInfo.BreachTxHash
|
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)
|
hint, key := blob.NewBreachHintAndKeyFromHash(&breachTxID)
|
||||||
|
|
||||||
// Then, we'll encrypt the computed justice kit using the full breach
|
// Then, we'll encrypt the computed justice kit using the full breach
|
||||||
|
@ -652,7 +652,7 @@ func testBackupTask(t *testing.T, test backupTaskTest) {
|
|||||||
hint, encBlob, err := task.craftSessionPayload(test.signer)
|
hint, encBlob, err := task.craftSessionPayload(test.signer)
|
||||||
require.NoError(t, err, "unable to craft session payload")
|
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
|
breachTxID := test.breachInfo.BreachTxHash
|
||||||
expHint := blob.NewBreachHintFromHash(&breachTxID)
|
expHint := blob.NewBreachHintFromHash(&breachTxID)
|
||||||
require.Equal(t, expHint, hint)
|
require.Equal(t, expHint, hint)
|
||||||
|
Reference in New Issue
Block a user