Skip to content

Commit a2ba0a8

Browse files
committed
Merge pull request #25
6d11a20 Add a test for proper exception raising on bad start (Isaac Cook)
2 parents 336dce5 + 6d11a20 commit a2ba0a8

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

bitcoin/tests/test_messages.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ def test_read_msg_verack(self):
114114
m = MsgSerializable.stream_deserialize(f)
115115
self.assertEqual(m.command, msg_verack.command)
116116

117+
def test_fail_invalid_message(self):
118+
bad_verack_bytes = b'\xf8' + self.verackbytes[1:]
119+
f = BytesIO(bad_verack_bytes)
120+
with self.assertRaises(ValueError):
121+
MsgSerializable.stream_deserialize(f)
122+
117123
def test_msg_verack_to_bytes(self):
118124
m = msg_verack()
119125
b = m.to_bytes()

0 commit comments

Comments
 (0)