diff --git a/src/util/validation.cpp b/src/util/validation.cpp index bd52f577516..0ba9915efb9 100644 --- a/src/util/validation.cpp +++ b/src/util/validation.cpp @@ -5,15 +5,20 @@ #include -#include #include -/** Convert ValidationState to a human-readable message for logging */ std::string FormatStateMessage(const ValidationState &state) { - return strprintf("%s%s", - state.GetRejectReason(), - state.GetDebugMessage().empty() ? "" : ", "+state.GetDebugMessage()); + if (state.IsValid()) { + return "Valid"; + } + + const std::string debug_message = state.GetDebugMessage(); + if (!debug_message.empty()) { + return strprintf("%s, %s", state.GetRejectReason(), debug_message); + } + + return state.GetRejectReason(); } const std::string strMessageMagic = "Bitcoin Signed Message:\n"; diff --git a/src/util/validation.h b/src/util/validation.h index da2cf9f102e..7ab57ed195e 100644 --- a/src/util/validation.h +++ b/src/util/validation.h @@ -6,9 +6,9 @@ #ifndef BITCOIN_UTIL_VALIDATION_H #define BITCOIN_UTIL_VALIDATION_H -#include +#include -class ValidationState; +#include /** Convert ValidationState to a human-readable message for logging */ std::string FormatStateMessage(const ValidationState &state);