Add function to convert CValidationState to a human-readable message

It is necessary to be able to concisely log a validation state.
Convert CValidationState to a human-readable message for logging.

(cherry picked from commit 9003c7cdd88402986e48ec126258fc10d6742fc7)
This commit is contained in:
Wladimir J. van der Laan 2015-08-06 09:53:24 +02:00 committed by Jack Grigg
parent aa97bd1c60
commit 3a5474e3f3
1 changed files with 8 additions and 0 deletions

View File

@ -1715,6 +1715,14 @@ CAmount GetMinRelayFee(const CTransaction& tx, const CTxMemPool& pool, unsigned
return nMinFee;
}
/** Convert CValidationState to a human-readable message for logging */
static std::string FormatStateMessage(const CValidationState &state)
{
return strprintf("%s%s (code %i)",
state.GetRejectReason(),
state.GetDebugMessage().empty() ? "" : ", "+state.GetDebugMessage(),
state.GetRejectCode());
}
bool AcceptToMemoryPool(
const CChainParams& chainparams,