Skip to content

Commit fd5c5d4

Browse files
authored
add handling for MalformedMessage during peer connection (#1242)
* add handling for MalformedMessage during peer connection * Dump full stack traces in debug logs
1 parent c4e602f commit fd5c5d4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

p2p/peer.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,15 @@ async def connect(self, remote: Node) -> BasePeer:
811811
except BadAckMessage:
812812
# This is kept separate from the `expected_exceptions` to be sure that we aren't
813813
# silencing an error in our authentication code.
814-
self.logger.info('Got bad auth ack from %r', remote)
814+
self.logger.error('Got bad auth ack from %r', remote)
815+
# dump the full stacktrace in the debug logs
816+
self.logger.debug('Got bad auth ack from %r', remote, exc_info=True)
817+
except MalformedMessage:
818+
# This is kept separate from the `expected_exceptions` to be sure that we aren't
819+
# silencing an error in how we decode messages during handshake.
820+
self.logger.error('Got malformed response from %r during handshake', remote)
821+
# dump the full stacktrace in the debug logs
822+
self.logger.debug('Got malformed response from %r', remote, exc_info=True)
815823
except expected_exceptions as e:
816824
self.logger.debug("Could not complete handshake with %r: %s", remote, repr(e))
817825
except Exception:

0 commit comments

Comments
 (0)