Skip to content

Commit 1d5325a

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25117: test: Check msg type in msg capture is followed by zeros
faa5a7a test: Check msg type in msg capture is followed by zeros (MacroFake) Pull request description: Checking that they are not printable is an odd (and wrong) way to check that all chars are zero. ACKs for top commit: theStack: Code-review ACK faa5a7a Tree-SHA512: 63e001bd25298dcf47606f8ab11ddfb704ca963304149b0f6e188eb7dcf45c41f92d39f26bda32bceb03384720c9bdddb2673dba513cd9242dc9663d498b3f29
2 parents b3f0a34 + faa5a7a commit 1d5325a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

test/functional/p2p_message_capture.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,8 @@ def mini_parser(dat_file):
4343
break
4444
tmp_header = BytesIO(tmp_header_raw)
4545
tmp_header.read(TIME_SIZE) # skip the timestamp field
46-
raw_msgtype = tmp_header.read(MSGTYPE_SIZE)
47-
msgtype: bytes = raw_msgtype.split(b'\x00', 1)[0]
48-
remainder = raw_msgtype.split(b'\x00', 1)[1]
49-
assert(len(msgtype) > 0)
46+
msgtype = tmp_header.read(MSGTYPE_SIZE).rstrip(b'\x00')
5047
assert(msgtype in MESSAGEMAP)
51-
assert(len(remainder) == 0 or not remainder.decode().isprintable())
5248
length: int = int.from_bytes(tmp_header.read(LENGTH_SIZE), "little")
5349
data = f_in.read(length)
5450
assert_equal(len(data), length)

0 commit comments

Comments
 (0)