mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 08:13:00 +02:00
lnwallet: update channel state machine tests to use distinct keys
In this commit, we update the channel state machine tests to use a new key for each purpose. Before this commit, the same key would be used the entire time. As a result, a few bugs slipped by that would’ve been detected if we used fresh keys for each purpose. Additionally, this reflect the real world case as we always use distinct keys for each purpose to avoid key re-use.
This commit is contained in:
@@ -443,7 +443,7 @@ func TestHTLCSenderSpendValidation(t *testing.T) {
|
||||
InputIndex: 0,
|
||||
}
|
||||
|
||||
return senderHtlcSpendRedeem(bobSigner, signDesc,
|
||||
return SenderHtlcSpendRedeem(bobSigner, signDesc,
|
||||
sweepTx,
|
||||
// Invalid preimage length
|
||||
bytes.Repeat([]byte{1}, 45))
|
||||
@@ -464,7 +464,7 @@ func TestHTLCSenderSpendValidation(t *testing.T) {
|
||||
InputIndex: 0,
|
||||
}
|
||||
|
||||
return senderHtlcSpendRedeem(bobSigner, signDesc,
|
||||
return SenderHtlcSpendRedeem(bobSigner, signDesc,
|
||||
sweepTx, paymentPreimage)
|
||||
}),
|
||||
true,
|
||||
@@ -728,7 +728,7 @@ func TestHTLCReceiverSpendValidation(t *testing.T) {
|
||||
}
|
||||
|
||||
return receiverHtlcSpendTimeout(aliceSigner, signDesc,
|
||||
sweepTx, cltvTimeout-2)
|
||||
sweepTx, int32(cltvTimeout-2))
|
||||
}),
|
||||
false,
|
||||
},
|
||||
@@ -746,7 +746,7 @@ func TestHTLCReceiverSpendValidation(t *testing.T) {
|
||||
}
|
||||
|
||||
return receiverHtlcSpendTimeout(aliceSigner, signDesc,
|
||||
sweepTx, cltvTimeout)
|
||||
sweepTx, int32(cltvTimeout))
|
||||
}),
|
||||
true,
|
||||
},
|
||||
|
Reference in New Issue
Block a user