lnwire: update testing.Quick tests to alternate between encoding types

This commit is contained in:
Olaoluwa Osuntokun 2018-06-15 18:34:11 -07:00
parent 5caf3d7310
commit 940b95aad7
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

View File

@ -651,9 +651,14 @@ func TestLightningWireProtocol(t *testing.T) {
v[0] = reflect.ValueOf(req)
},
MsgQueryShortChanIDs: func(v []reflect.Value, r *rand.Rand) {
req := QueryShortChanIDs{
// TODO(roasbeef): later alternate encoding types
EncodingType: EncodingSortedPlain,
req := QueryShortChanIDs{}
// With a 50/50 change, we'll either use zlib encoding,
// or regular encoding.
if r.Int31()%2 == 0 {
req.EncodingType = EncodingSortedZlib
} else {
req.EncodingType = EncodingSortedPlain
}
if _, err := rand.Read(req.ChainHash[:]); err != nil {
@ -687,8 +692,13 @@ func TestLightningWireProtocol(t *testing.T) {
req.Complete = uint8(r.Int31n(2))
// TODO(roasbeef): later alternate encoding types
req.EncodingType = EncodingSortedPlain
// With a 50/50 change, we'll either use zlib encoding,
// or regular encoding.
if r.Int31()%2 == 0 {
req.EncodingType = EncodingSortedZlib
} else {
req.EncodingType = EncodingSortedPlain
}
numChanIDs := rand.Int31n(5000)