mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-27 03:33:27 -03:00
test: Check msg type in msg capture is followed by zeros
This commit is contained in:
parent
dd9f61a184
commit
faa5a7a573
1 changed files with 1 additions and 5 deletions
|
@ -43,12 +43,8 @@ def mini_parser(dat_file):
|
||||||
break
|
break
|
||||||
tmp_header = BytesIO(tmp_header_raw)
|
tmp_header = BytesIO(tmp_header_raw)
|
||||||
tmp_header.read(TIME_SIZE) # skip the timestamp field
|
tmp_header.read(TIME_SIZE) # skip the timestamp field
|
||||||
raw_msgtype = tmp_header.read(MSGTYPE_SIZE)
|
msgtype = tmp_header.read(MSGTYPE_SIZE).rstrip(b'\x00')
|
||||||
msgtype: bytes = raw_msgtype.split(b'\x00', 1)[0]
|
|
||||||
remainder = raw_msgtype.split(b'\x00', 1)[1]
|
|
||||||
assert(len(msgtype) > 0)
|
|
||||||
assert(msgtype in MESSAGEMAP)
|
assert(msgtype in MESSAGEMAP)
|
||||||
assert(len(remainder) == 0 or not remainder.decode().isprintable())
|
|
||||||
length: int = int.from_bytes(tmp_header.read(LENGTH_SIZE), "little")
|
length: int = int.from_bytes(tmp_header.read(LENGTH_SIZE), "little")
|
||||||
data = f_in.read(length)
|
data = f_in.read(length)
|
||||||
assert_equal(len(data), length)
|
assert_equal(len(data), length)
|
||||||
|
|
Loading…
Add table
Reference in a new issue