When parsing the buffer, the message itself may be malformed and unable to parse correctly, which will typically throw an error (as so it's clear why it's failing).
A try/catch around https://github.com/bitpay/bitcore-p2p/blob/master/lib/messages/index.js#L103 and sending back a reject message (https://en.bitcoin.it/wiki/Protocol_documentation#reject) to the peer with REJECT_MALFORMED, could be the best way to handle this case.
Related: #85
When parsing the buffer, the message itself may be malformed and unable to parse correctly, which will typically throw an error (as so it's clear why it's failing).
A
try/catcharound https://github.com/bitpay/bitcore-p2p/blob/master/lib/messages/index.js#L103 and sending back arejectmessage (https://en.bitcoin.it/wiki/Protocol_documentation#reject) to the peer with REJECT_MALFORMED, could be the best way to handle this case.Related: #85