mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-27 09:21:43 +02:00
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
This commit is contained in:
commit
1d5325a8f9
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user