mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
Merge bitcoin/bitcoin#25117: test: Check msg type in msg capture is followed by zeros
faa5a7a573test: 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 ACKfaa5a7a573Tree-SHA512: 63e001bd25298dcf47606f8ab11ddfb704ca963304149b0f6e188eb7dcf45c41f92d39f26bda32bceb03384720c9bdddb2673dba513cd9242dc9663d498b3f29
This commit is contained in:
commit
1d5325a8f9
1 changed files with 1 additions and 5 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue