Merge pull request #7894 from yyforyongyu/fix-lnwire-test-flake

trivial: fix unit test flake for `Ping` message
This commit is contained in:
Oliver Gugger 2023-08-18 09:42:59 +02:00 committed by GitHub
commit 4a03074fe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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,