aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_message_capture.py
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-05-12 16:17:54 +0200
committerMacroFake <falke.marco@gmail.com>2022-05-12 17:07:35 +0200
commitfaa5a7a5735b054b5fd2dca6ef6fca2fad6edbde (patch)
tree48ebfba171230b4adcfafe7c8a336bb0ca3f8e00 /test/functional/p2p_message_capture.py
parentdd9f61a184d4d395591ee3e9f1e839473e88ffd0 (diff)
downloadbitcoin-faa5a7a5735b054b5fd2dca6ef6fca2fad6edbde.tar.xz
test: Check msg type in msg capture is followed by zeros
Diffstat (limited to 'test/functional/p2p_message_capture.py')
-rwxr-xr-xtest/functional/p2p_message_capture.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/test/functional/p2p_message_capture.py b/test/functional/p2p_message_capture.py
index 0a7ae44de4..87c77f4540 100755
--- a/test/functional/p2p_message_capture.py
+++ b/test/functional/p2p_message_capture.py
@@ -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)