diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-08-06 09:53:24 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-08-11 17:29:33 +0200 |
commit | 9003c7cdd88402986e48ec126258fc10d6742fc7 (patch) | |
tree | c58ec8372165dfb0a091b3e975ec1a33014975bd /src/main.cpp | |
parent | dc58258adf1fb1e05002c3057045f113aa214cb7 (diff) |
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.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 5949e5285d..3d7a620433 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -778,6 +778,14 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF 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(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool* pfMissingInputs, bool fRejectAbsurdFee) |