Avoid reject message feedback loops

This commit is contained in:
Pieter Wuille 2014-09-12 16:37:53 +02:00
parent 3fa1c81b94
commit efad808aae

View File

@ -4106,8 +4106,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
else if (strCommand == "reject")
{
if (fDebug)
{
if (fDebug) {
try {
string strMsg; unsigned char ccode; string strReason;
vRecv >> LIMITED_STRING(strMsg, CMessageHeader::COMMAND_SIZE) >> ccode >> LIMITED_STRING(strReason, 111);
@ -4121,6 +4121,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
ss << ": hash " << hash.ToString();
}
LogPrint("net", "Reject %s\n", SanitizeString(ss.str()));
} catch (std::ios_base::failure& e) {
// Avoid feedback loops by preventing reject messages from triggering a new reject message.
LogPrint("net", "Unparseable reject message received\n");
}
}
}