|
|
@@ -1233,14 +1233,14 @@ void CheckForkWarningConditions() |
|
|
|
} |
|
|
|
if (pindexBestForkTip && pindexBestForkBase) |
|
|
|
{ |
|
|
|
LogPrintf("CheckForkWarningConditions: Warning: Large valid fork found\n forking the chain at height %d (%s)\n lasting to height %d (%s).\nChain state database corruption likely.\n", |
|
|
|
LogPrintf("%s: Warning: Large valid fork found\n forking the chain at height %d (%s)\n lasting to height %d (%s).\nChain state database corruption likely.\n", __func__, |
|
|
|
pindexBestForkBase->nHeight, pindexBestForkBase->phashBlock->ToString(), |
|
|
|
pindexBestForkTip->nHeight, pindexBestForkTip->phashBlock->ToString()); |
|
|
|
fLargeWorkForkFound = true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
LogPrintf("CheckForkWarningConditions: Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.\n"); |
|
|
|
LogPrintf("%s: Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.\n", __func__); |
|
|
|
fLargeWorkInvalidChainFound = true; |
|
|
|
} |
|
|
|
} |
|
|
@@ -1298,10 +1298,10 @@ void Misbehaving(NodeId pnode, int howmuch) |
|
|
|
int banscore = GetArg("-banscore", 100); |
|
|
|
if (state->nMisbehavior >= banscore && state->nMisbehavior - howmuch < banscore) |
|
|
|
{ |
|
|
|
LogPrintf("Misbehaving: %s (%d -> %d) BAN THRESHOLD EXCEEDED\n", state->name, state->nMisbehavior-howmuch, state->nMisbehavior); |
|
|
|
LogPrintf("%s: %s (%d -> %d) BAN THRESHOLD EXCEEDED\n", __func__, state->name, state->nMisbehavior-howmuch, state->nMisbehavior); |
|
|
|
state->fShouldBan = true; |
|
|
|
} else |
|
|
|
LogPrintf("Misbehaving: %s (%d -> %d)\n", state->name, state->nMisbehavior-howmuch, state->nMisbehavior); |
|
|
|
LogPrintf("%s: %s (%d -> %d)\n", __func__, state->name, state->nMisbehavior-howmuch, state->nMisbehavior); |
|
|
|
} |
|
|
|
|
|
|
|
void static InvalidChainFound(CBlockIndex* pindexNew) |
|
|
@@ -1309,11 +1309,11 @@ void static InvalidChainFound(CBlockIndex* pindexNew) |
|
|
|
if (!pindexBestInvalid || pindexNew->nChainWork > pindexBestInvalid->nChainWork) |
|
|
|
pindexBestInvalid = pindexNew; |
|
|
|
|
|
|
|
LogPrintf("InvalidChainFound: invalid block=%s height=%d log2_work=%.8g date=%s\n", |
|
|
|
LogPrintf("%s: invalid block=%s height=%d log2_work=%.8g date=%s\n", __func__, |
|
|
|
pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, |
|
|
|
log(pindexNew->nChainWork.getdouble())/log(2.0), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", |
|
|
|
pindexNew->GetBlockTime())); |
|
|
|
LogPrintf("InvalidChainFound: current best=%s height=%d log2_work=%.8g date=%s\n", |
|
|
|
LogPrintf("%s: current best=%s height=%d log2_work=%.8g date=%s\n", __func__, |
|
|
|
chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), log(chainActive.Tip()->nChainWork.getdouble())/log(2.0), |
|
|
|
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime())); |
|
|
|
CheckForkWarningConditions(); |
|
|
@@ -1921,7 +1921,7 @@ void static UpdateTip(CBlockIndex *pindexNew) { |
|
|
|
nTimeBestReceived = GetTime(); |
|
|
|
mempool.AddTransactionsUpdated(1); |
|
|
|
|
|
|
|
LogPrintf("UpdateTip: new best=%s height=%d log2_work=%.8g tx=%lu date=%s progress=%f cache=%u\n", |
|
|
|
LogPrintf("%s: new best=%s height=%d log2_work=%.8g tx=%lu date=%s progress=%f cache=%u\n", __func__, |
|
|
|
chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), log(chainActive.Tip()->nChainWork.getdouble())/log(2.0), (unsigned long)chainActive.Tip()->nChainTx, |
|
|
|
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()), |
|
|
|
Checkpoints::GuessVerificationProgress(chainActive.Tip()), (unsigned int)pcoinsTip->GetCacheSize()); |
|
|
@@ -1941,7 +1941,7 @@ void static UpdateTip(CBlockIndex *pindexNew) { |
|
|
|
pindex = pindex->pprev; |
|
|
|
} |
|
|
|
if (nUpgraded > 0) |
|
|
|
LogPrintf("SetBestChain: %d of last 100 blocks above version %d\n", nUpgraded, (int)CBlock::CURRENT_VERSION); |
|
|
|
LogPrintf("%s: %d of last 100 blocks above version %d\n", __func__, nUpgraded, (int)CBlock::CURRENT_VERSION); |
|
|
|
if (nUpgraded > 100/2) |
|
|
|
{ |
|
|
|
// strMiscWarning is read by GetWarnings(), called by Qt and the JSON-RPC code to warn the user: |
|
|
@@ -2936,7 +2936,7 @@ bool static LoadBlockIndexDB() |
|
|
|
|
|
|
|
// Check whether we have a transaction index |
|
|
|
pblocktree->ReadFlag("txindex", fTxIndex); |
|
|
|
LogPrintf("LoadBlockIndexDB(): transaction index %s\n", fTxIndex ? "enabled" : "disabled"); |
|
|
|
LogPrintf("%s(): transaction index %s\n", __func__, fTxIndex ? "enabled" : "disabled"); |
|
|
|
|
|
|
|
// Load pointer to end of best chain |
|
|
|
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); |
|
|
@@ -2946,7 +2946,7 @@ bool static LoadBlockIndexDB() |
|
|
|
|
|
|
|
PruneBlockIndexCandidates(); |
|
|
|
|
|
|
|
LogPrintf("LoadBlockIndexDB(): hashBestChain=%s height=%d date=%s progress=%f\n", |
|
|
|
LogPrintf("%s(): hashBestChain=%s height=%d date=%s progress=%f\n", __func__, |
|
|
|
chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), |
|
|
|
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()), |
|
|
|
Checkpoints::GuessVerificationProgress(chainActive.Tip())); |
|
|
@@ -3492,7 +3492,7 @@ void static ProcessGetData(CNode* pfrom) |
|
|
|
send = mi->second->IsValid(BLOCK_VALID_SCRIPTS) && (pindexBestHeader != NULL) && |
|
|
|
(mi->second->GetBlockTime() > pindexBestHeader->GetBlockTime() - 30 * 24 * 60 * 60); |
|
|
|
if (!send) { |
|
|
|
LogPrintf("ProcessGetData(): ignoring request from peer=%i for old block that isn't in the main chain\n", pfrom->GetId()); |
|
|
|
LogPrintf("%s: ignoring request from peer=%i for old block that isn't in the main chain\n", __func__, pfrom->GetId()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -4394,7 +4394,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, |
|
|
|
bool ProcessMessages(CNode* pfrom) |
|
|
|
{ |
|
|
|
//if (fDebug) |
|
|
|
// LogPrintf("ProcessMessages(%u messages)\n", pfrom->vRecvMsg.size()); |
|
|
|
// LogPrintf("%s(%u messages)\n", __func__, pfrom->vRecvMsg.size()); |
|
|
|
|
|
|
|
// |
|
|
|
// Message format |
|
|
@@ -4422,7 +4422,7 @@ bool ProcessMessages(CNode* pfrom) |
|
|
|
CNetMessage& msg = *it; |
|
|
|
|
|
|
|
//if (fDebug) |
|
|
|
// LogPrintf("ProcessMessages(message %u msgsz, %u bytes, complete:%s)\n", |
|
|
|
// LogPrintf("%s(message %u msgsz, %u bytes, complete:%s)\n", __func__, |
|
|
|
// msg.hdr.nMessageSize, msg.vRecv.size(), |
|
|
|
// msg.complete() ? "Y" : "N"); |
|
|
|
|
|
|
@@ -4458,7 +4458,7 @@ bool ProcessMessages(CNode* pfrom) |
|
|
|
unsigned int nChecksum = ReadLE32((unsigned char*)&hash); |
|
|
|
if (nChecksum != hdr.nChecksum) |
|
|
|
{ |
|
|
|
LogPrintf("ProcessMessages(%s, %u bytes): CHECKSUM ERROR nChecksum=%08x hdr.nChecksum=%08x\n", |
|
|
|
LogPrintf("%s(%s, %u bytes): CHECKSUM ERROR nChecksum=%08x hdr.nChecksum=%08x\n", __func__, |
|
|
|
SanitizeString(strCommand), nMessageSize, nChecksum, hdr.nChecksum); |
|
|
|
continue; |
|
|
|
} |
|
|
@@ -4476,12 +4476,12 @@ bool ProcessMessages(CNode* pfrom) |
|
|
|
if (strstr(e.what(), "end of data")) |
|
|
|
{ |
|
|
|
// Allow exceptions from under-length message on vRecv |
|
|
|
LogPrintf("ProcessMessages(%s, %u bytes): Exception '%s' caught, normally caused by a message being shorter than its stated length\n", SanitizeString(strCommand), nMessageSize, e.what()); |
|
|
|
LogPrintf("%s(%s, %u bytes): Exception '%s' caught, normally caused by a message being shorter than its stated length\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); |
|
|
|
} |
|
|
|
else if (strstr(e.what(), "size too large")) |
|
|
|
{ |
|
|
|
// Allow exceptions from over-long size |
|
|
|
LogPrintf("ProcessMessages(%s, %u bytes): Exception '%s' caught\n", SanitizeString(strCommand), nMessageSize, e.what()); |
|
|
|
LogPrintf("%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
@@ -4498,7 +4498,7 @@ bool ProcessMessages(CNode* pfrom) |
|
|
|
} |
|
|
|
|
|
|
|
if (!fRet) |
|
|
|
LogPrintf("ProcessMessage(%s, %u bytes) FAILED peer=%d\n", SanitizeString(strCommand), nMessageSize, pfrom->id); |
|
|
|
LogPrintf("%s(%s, %u bytes) FAILED peer=%d\n", __func__, SanitizeString(strCommand), nMessageSize, pfrom->id); |
|
|
|
|
|
|
|
break; |
|
|
|
} |