mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Merge pull request #4903
efad808
Avoid reject message feedback loops (Pieter Wuille)
This commit is contained in:
commit
13168ea46c
28
src/main.cpp
28
src/main.cpp
@ -4111,21 +4111,25 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
|
|
||||||
else if (strCommand == "reject")
|
else if (strCommand == "reject")
|
||||||
{
|
{
|
||||||
if (fDebug)
|
if (fDebug) {
|
||||||
{
|
try {
|
||||||
string strMsg; unsigned char ccode; string strReason;
|
string strMsg; unsigned char ccode; string strReason;
|
||||||
vRecv >> LIMITED_STRING(strMsg, CMessageHeader::COMMAND_SIZE) >> ccode >> LIMITED_STRING(strReason, 111);
|
vRecv >> LIMITED_STRING(strMsg, CMessageHeader::COMMAND_SIZE) >> ccode >> LIMITED_STRING(strReason, 111);
|
||||||
|
|
||||||
ostringstream ss;
|
ostringstream ss;
|
||||||
ss << strMsg << " code " << itostr(ccode) << ": " << strReason;
|
ss << strMsg << " code " << itostr(ccode) << ": " << strReason;
|
||||||
|
|
||||||
if (strMsg == "block" || strMsg == "tx")
|
if (strMsg == "block" || strMsg == "tx")
|
||||||
{
|
{
|
||||||
uint256 hash;
|
uint256 hash;
|
||||||
vRecv >> hash;
|
vRecv >> hash;
|
||||||
ss << ": hash " << hash.ToString();
|
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");
|
||||||
}
|
}
|
||||||
LogPrint("net", "Reject %s\n", SanitizeString(ss.str()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user