Skip to content

Commit 66daed5

Browse files
committed
Add information to errors in ConnectBlock, CheckBlock
Add detailed state information to the errors, as it is no longer being logged downstream. Also add the state information to mempool rejection debug message in ProcessMessages.
1 parent 6cab808 commit 66daed5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
17771777

17781778
std::vector<CScriptCheck> vChecks;
17791779
if (!CheckInputs(tx, state, view, fScriptChecks, flags, false, nScriptCheckThreads ? &vChecks : NULL))
1780-
return false;
1780+
return error("ConnectBlock(): CheckInputs on %s failed with %s",
1781+
tx.GetHash().ToString(), FormatStateMessage(state));
17811782
control.Add(vChecks);
17821783
}
17831784

@@ -2604,7 +2605,9 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
26042605
// Check transactions
26052606
BOOST_FOREACH(const CTransaction& tx, block.vtx)
26062607
if (!CheckTransaction(tx, state))
2607-
return error("CheckBlock(): CheckTransaction failed");
2608+
return error("CheckBlock(): CheckTransaction of %s failed with %s",
2609+
tx.GetHash().ToString(),
2610+
FormatStateMessage(state));
26082611

26092612
unsigned int nSigOps = 0;
26102613
BOOST_FOREACH(const CTransaction& tx, block.vtx)
@@ -4341,7 +4344,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
43414344
{
43424345
LogPrint("mempool", "%s from peer=%d %s was not accepted into the memory pool: %s\n", tx.GetHash().ToString(),
43434346
pfrom->id, pfrom->cleanSubVer,
4344-
state.GetRejectReason());
4347+
FormatStateMessage(state));
43454348
if (state.GetRejectCode() < REJECT_INTERNAL) // Never send AcceptToMemoryPool's internal codes over P2P
43464349
pfrom->PushMessage("reject", strCommand, state.GetRejectCode(),
43474350
state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), inv.hash);

0 commit comments

Comments
 (0)