Skip to content

Commit

Permalink
Merge bitcoin#25117: test: Check msg type in msg capture is followed …
Browse files Browse the repository at this point in the history
…by zeros
  • Loading branch information
vijaydasmp authored and PastaPastaPasta committed Feb 14, 2024
1 parent 74577ee commit 639705e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions test/functional/p2p_message_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,8 @@ def mini_parser(dat_file):
break
tmp_header = BytesIO(tmp_header_raw)
tmp_header.read(TIME_SIZE) # skip the timestamp field
raw_msgtype = tmp_header.read(MSGTYPE_SIZE)
msgtype: bytes = raw_msgtype.split(b'\x00', 1)[0]
remainder = raw_msgtype.split(b'\x00', 1)[1]
assert(len(msgtype) > 0)
msgtype = tmp_header.read(MSGTYPE_SIZE).rstrip(b'\x00')
assert(msgtype in MESSAGEMAP)
assert(len(remainder) == 0 or not remainder.decode().isprintable())
length: int = int.from_bytes(tmp_header.read(LENGTH_SIZE), "little")
data = f_in.read(length)
assert_equal(len(data), length)
Expand Down

0 comments on commit 639705e

Please sign in to comment.