mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-28 10:41:57 +01:00
contractcourt: fix test flake in TestTaprootBriefcase
When the numTweaks is zero, we should return a nil instead of initializing an empty map as we'd get the following error, ``` Diff: --- Expected +++ Actual @@ -11007,4 +11007,3 @@ }, - BreachedHtlcTweaks: (contractcourt.htlcTapTweaks) { - }, + BreachedHtlcTweaks: (contractcourt.htlcTapTweaks) <nil>, ```
This commit is contained in:
parent
1968034075
commit
a252cb4528
@ -29,8 +29,14 @@ func randResolverCtrlBlocks(t *testing.T) resolverCtrlBlocks {
|
|||||||
|
|
||||||
func randHtlcTweaks(t *testing.T) htlcTapTweaks {
|
func randHtlcTweaks(t *testing.T) htlcTapTweaks {
|
||||||
numTweaks := rand.Int() % 256
|
numTweaks := rand.Int() % 256
|
||||||
tweaks := make(htlcTapTweaks, numTweaks)
|
|
||||||
|
|
||||||
|
// If the numTweaks happens to be zero, we return a nil to avoid
|
||||||
|
// initializing the map.
|
||||||
|
if numTweaks == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
tweaks := make(htlcTapTweaks, numTweaks)
|
||||||
for i := 0; i < numTweaks; i++ {
|
for i := 0; i < numTweaks; i++ {
|
||||||
var id resolverID
|
var id resolverID
|
||||||
_, err := rand.Read(id[:])
|
_, err := rand.Read(id[:])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user