lnwire/lnwire_test: use nil slice when 0 sids

Modifies the behavior of the quick test for
MsgQueryShortChanIDs, such that the generated
slice of expected short chan ids is always nil
if no elements are returned. This mimics the
behavior of the zlib decompression, where
elements are appended to the slice, instead of
assigning to preallocated slice.
This commit is contained in:
Conner Fromknecht 2018-06-28 19:02:36 -07:00
parent 9205720bea
commit 8cc217b526
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF

@ -668,11 +668,9 @@ func TestLightningWireProtocol(t *testing.T) {
numChanIDs := rand.Int31n(5000) numChanIDs := rand.Int31n(5000)
req.ShortChanIDs = make([]ShortChannelID, numChanIDs)
for i := int32(0); i < numChanIDs; i++ { for i := int32(0); i < numChanIDs; i++ {
req.ShortChanIDs[i] = NewShortChanIDFromInt( req.ShortChanIDs = append(req.ShortChanIDs,
uint64(r.Int63()), NewShortChanIDFromInt(uint64(r.Int63())))
)
} }
v[0] = reflect.ValueOf(req) v[0] = reflect.ValueOf(req)