What is it for....
Before this update, you could see in the log file -
2019-03-18 04:39:22 UTC received: inv (73 bytes)
got inventory: tx a95eb73d454b8469705b new
strCommand 'inv' - spam hash previous: ck 34ffd65274414510f - outofstock
askfor tx a95eb73d454b8469705b 0 (00:00:00)
got inventory: tx bdfacc80ed0878f1f235 new
strCommand 'inv' - spam hash previous: ck 34ffd65274414510f - outofstock
askfor tx bdfacc80ed0878f1f235 0 (00:00:00)
sending getdata: tx a95eb73d454b8469705b
sending getdata: tx bdfacc80ed0878f1f235
sending: getdata (73 bytes)
BAD MSGCOMPLETE - BREAK
ProcessMessages(tx, 56096 bytes) : CHECKSUM ERROR - CONTINUE nChecksum=35ed1baf hdr.nChecksum=c49b7f72
BAD MSGCOMPLETE - BREAK
ProcessMessages(tx, 56096 bytes) : CHECKSUM ERROR - CONTINUE nChecksum=7772b533 hdr.nChecksum=c49b7f72
2019-03-18 04:39:22 UTC received: tx (56096 bytes)
trying connection 91.82.212.214:2225 lastseen=152,3hrs
'CTxMemPool - Accept' - ThreadAnalyzerHandler() : accepted a95eb73d45 (poolsz 1)
strCommand 'tx' - AcceptToMemoryPool: xxx.xxx.xxx.73:51090 /CACHEProject 2018:0.7.6.21/ : accepted a95eb73d454b8469705bc8ddffb749161c3ca41b0c3f6a210d1f043dc49b7f72 (poolsz 1)
connect() failed after select(): B coeдинeнии oткaзaнo
trying connection 194.154.78.195:2225 lastseen=36,5hrs
connection timeout
At first glance, everything is fine - with a few small errors. After the last update, it is not so harmless.
2019-03-20 14:08:00 UTC received: inv (73 bytes)
Switch test mode ('inv' contains more than one transaction)
ThreadRPCServer method=gettransaction
got inventory: tx a95eb73d454b8469705b new
strCommand 'inv' - spam hash previous: Spam is missing now - outofstock
askfor tx a95eb73d454b8469705b 0 (00:00:00)
got inventory: tx bdfacc80ed0878f1f235 new
strCommand 'inv' - spam hash previous: Spam is missing now - outofstock
askfor tx bdfacc80ed0878f1f235 0 (00:00:00)
sending getdata: tx a95eb73d454b8469705b
sending getdata: tx bdfacc80ed0878f1f235
sending: getdata (73 bytes)
ThreadRPCServer method=getblock
ProcessMessages(tx, 56096 bytes) : BAD MSGCOMPLETE IF CHECKSUM ERROR - CONTINUE nChecksum=2c043ff7 hdr.nChecksum=c49b7f72
2019-03-20 14:08:00 UTC received: tx (56096 bytes)
ERROR: 'Transaction - CheckTransaction' - ThreadAnalyzerHandler() : vout empty
strCommand 'tx' - The executor of the rules performed the work
strCommand 'tx' - spam hash previous: 63d6de921f25bff5da96 - outofstock
strCommand 'tx' - spam hash actual: 63d6de921f25bff5da96 - outofstock
ProcessMessage(tx, 56096 bytes) FAILED
ThreadRPCServer method=gettransaction
disconnecting node xxx.xxx.xxx.73:60833
ThreadRPCServer method=getblock
trying connection 194.154.78.195:2225 lastseen=94,0hrs
2019-03-16 06:01:25 UTC received: inv (37 bytes)
got inventory: tx 7405f2ab32944cfac5b0 new
strCommand 'inv' - spam hash previous: Spam is missing now - outofstock
askfor tx 7405f2ab32944cfac5b0 0 (00:00:00)
sending getdata: tx 7405f2ab32944cfac5b0
sending: getdata (37 bytes)
BAD MSGCOMPLETE - BREAK
ProcessMessages(tx, 7112 bytes) : CHECKSUM ERROR - CONTINUE nChecksum=23dce890 hdr.nChecksum=7adc7b94
2019-03-16 06:01:25 UTC received: tx (7112 bytes)
ERROR: 'Transaction - CheckTransaction' - ThreadAnalyzerHandler() : vout empty
strCommand 'tx' - The executor of the rules performed the work
strCommand 'tx' - spam hash previous: ff86c6d8341aa8fab74b - outofstock
strCommand 'tx' - spam hash actual: ff86c6d8341aa8fab74b - outofstock
ProcessMessage(tx, 7112 bytes) FAILED
disconnecting node xxx.xxx.xxx.xxx:2225
connection timeout
I do not know who the author is, but this code has this vulnerability.
bool ProcessMessages(CNode* pfrom)
{
//CDataStream& vRecv = pfrom->vRecv;
//if (vRecv.empty())
// return true;
static int64 nTimeLastPrintMessageStart = 0;
if (fDebug && GetBoolArg("-printmessagestart") && nTimeLastPrintMessageStart + 30 < GetAdjustedTime())
{
string strMessageStart((const char *)pchMessageStart, sizeof(pchMessageStart));
vector vchMessageStart(strMessageStart.begin(), strMessageStart.end());
printf("ProcessMessages : AdjustedTime=%" PRI64d" MessageStart=%s\n", GetAdjustedTime(), HexStr(vchMessageStart).c_str());
nTimeLastPrintMessageStart = GetAdjustedTime();
}
bool fOk = true;
if (!pfrom->vRecvGetData.empty())
ProcessGetData(pfrom);
// this maintains the order of responses
if (!pfrom->vRecvGetData.empty())
return fOk;
//
// Message format
// (4) message start
// (12) command
// (4) size
// (4) checksum
// (x) data
//
std::deque::iterator it = pfrom->vRecvMsg.begin();
while (!pfrom->fDisconnect && it != pfrom->vRecvMsg.end())
{
// Don't bother if send buffer is too full to respond anyway
if (pfrom->vSend.size() >= SendBufferSize())
{
printf("\n\nSENDSIZE > SENDBUFFERSIZE - BREAK\n\n");
break;
}
CNetMessage& msg = *it;
if (!msg.complete())
{
printf("\n\nBAD MSGCOMPLETE - BREAK\n\n");
break;
}
it++;
// Scan for message start
if (memcmp(msg.hdr.pchMessageStart, pchMessageStart, sizeof(pchMessageStart)) != 0)
{
printf("\n\nPROCESSMESSAGE: INVALID MESSAGESTART - BREAK\n\n");
fOk = false;
break;
}
// Read header
CMessageHeader& hdr = msg.hdr;
if (!hdr.IsValid())
{
printf("\n\nPROCESSMESSAGE: ERRORS IN HEADER - CONTINUE %s\n\n\n", hdr.GetCommand().c_str());
continue;
}
string strCommand = hdr.GetCommand();
// Message size
unsigned int nMessageSize = hdr.nMessageSize;
// Checksum
CDataStream& vRecv = msg.vRecv;
uint256 hash = Hash(vRecv.begin(), vRecv.begin() + nMessageSize);
unsigned int nChecksum = 0;
memcpy(&nChecksum, &hash, sizeof(nChecksum));
if (nChecksum != hdr.nChecksum)
{
printf("ProcessMessages(%s, %u bytes) : CHECKSUM ERROR - CONTINUE nChecksum=%08x hdr.nChecksum=%08x\n",
strCommand.c_str(), nMessageSize, nChecksum, hdr.nChecksum);
continue;
}
// Message size - addr
std::string wait("addr"), addr(strCommand.c_str());
if (wait == addr)
{
if (nMessageSize > ADR_MAX_SIZE)
{
printf("ProcessMessages(%s, %u bytes) : PEERS.DAT EXCEEDS THE ALLOWABLE SIZE - CONTINUE\n", strCommand.c_str(), nMessageSize);
continue;
}
}
// Process message
bool fRet = false;
try
{
{
LOCK(cs_main);
fRet = ProcessMessage(pfrom, strCommand, vRecv);
}
boost::this_thread::interruption_point();
}
catch (std::ios_base::failure& e)
{
if (strstr(e.what(), "end of data"))
{
// Allow exceptions from under-length message on vRecv
printf("ProcessMessages(%s, %u bytes) : Exception '%s' caught, normally caused by a message being shorter than its stated length\n", strCommand.c_str(), nMessageSize, e.what());
}
else if (strstr(e.what(), "size too large"))
{
// Allow exceptions from over-long size
printf("ProcessMessages(%s, %u bytes) : Exception '%s' caught\n", strCommand.c_str(), nMessageSize, e.what());
}
else
{
PrintExceptionContinue(&e, "ProcessMessages()");
}
}
catch (boost::thread_interrupted) {
throw;
}
catch (std::exception& e) {
PrintExceptionContinue(&e, "ProcessMessages()");
} catch (...) {
PrintExceptionContinue(NULL, "ProcessMessages()");
}
if (!fRet)
printf("ProcessMessage(%s, %u bytes) FAILED\n", strCommand.c_str(), nMessageSize);
break;
}
// In case the connection got shut down, its receive buffer was wiped
if (!pfrom->fDisconnect)
pfrom->vRecvMsg.erase(pfrom->vRecvMsg.begin(), it);
return fOk;