lnwire: fix unit test flake for Ping message

This commit is contained in:
yyforyongyu 2023-08-17 23:49:38 +08:00
parent b565f4f536
commit 70bd6d1a11
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868

View File

@ -937,8 +937,9 @@ func TestLightningWireProtocol(t *testing.T) {
//
// We'll allow the test to generate padding bytes up to
// the max message limit, factoring in the 2 bytes for
// the num pong bytes.
paddingBytes := make([]byte, r.Intn(MaxMsgBody-1))
// the num pong bytes and 2 bytes for encoding the
// length of the padding bytes.
paddingBytes := make([]byte, rand.Intn(MaxMsgBody-3))
req := Ping{
NumPongBytes: uint16(r.Intn(MaxPongBytes + 1)),
PaddingBytes: paddingBytes,