qa: mininode: Clearer error message on invalid magic bytes

pull/764/head
MarcoFalke 6 years ago
parent 81f732bcaa
commit fab0a68aa2
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

@ -171,7 +171,7 @@ class P2PConnection(asyncio.Protocol):
if len(self.recvbuf) < 4:
return
if self.recvbuf[:4] != self.magic_bytes:
raise ValueError("got garbage %s" % repr(self.recvbuf))
raise ValueError("magic bytes mismatch: {} != {}".format(repr(self.magic_bytes), repr(self.recvbuf)))
if len(self.recvbuf) < 4 + 12 + 4 + 4:
return
command = self.recvbuf[4:4+12].split(b"\x00", 1)[0]

Loading…
Cancel
Save