mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-01 03:01:09 +02:00
qa: mininode: Clearer error message on invalid magic bytes
This commit is contained in:
@ -171,7 +171,7 @@ class P2PConnection(asyncio.Protocol):
|
|||||||
if len(self.recvbuf) < 4:
|
if len(self.recvbuf) < 4:
|
||||||
return
|
return
|
||||||
if self.recvbuf[:4] != self.magic_bytes:
|
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:
|
if len(self.recvbuf) < 4 + 12 + 4 + 4:
|
||||||
return
|
return
|
||||||
command = self.recvbuf[4:4+12].split(b"\x00", 1)[0]
|
command = self.recvbuf[4:4+12].split(b"\x00", 1)[0]
|
||||||
|
Reference in New Issue
Block a user