aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-05-13 07:49:20 +0200
committerMacroFake <falke.marco@gmail.com>2022-05-13 07:49:22 +0200
commit1d5325a8f975278c1089d685d5961488b8e407dc (patch)
tree170aa0aaea27b9cb88f301c998bbc9c788c97e8a /test
parentb3f0a34389a490c50d28e80e712dc5f42a533ec3 (diff)
parentfaa5a7a5735b054b5fd2dca6ef6fca2fad6edbde (diff)
downloadbitcoin-1d5325a8f975278c1089d685d5961488b8e407dc.tar.xz
Merge bitcoin/bitcoin#25117: test: Check msg type in msg capture is followed by zeros
faa5a7a5735b054b5fd2dca6ef6fca2fad6edbde 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 faa5a7a5735b054b5fd2dca6ef6fca2fad6edbde Tree-SHA512: 63e001bd25298dcf47606f8ab11ddfb704ca963304149b0f6e188eb7dcf45c41f92d39f26bda32bceb03384720c9bdddb2673dba513cd9242dc9663d498b3f29
Diffstat (limited to 'test')
-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)