From 72f3227c83810936e7a334304e5fd7c6dab8e91b Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Fri, 3 Jan 2020 11:32:22 -0800 Subject: [PATCH] Format CValidationState properly in all cases FormatStateMessage does not properly handle the case where CValidationState::IsValid() returns true. Use "Valid" for the state in this case. --- src/util/validation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/validation.cpp b/src/util/validation.cpp index bd52f577516..603db51d45a 100644 --- a/src/util/validation.cpp +++ b/src/util/validation.cpp @@ -11,6 +11,10 @@ /** Convert ValidationState to a human-readable message for logging */ std::string FormatStateMessage(const ValidationState &state) { + if (state.IsValid()) { + return "Valid"; + } + return strprintf("%s%s", state.GetRejectReason(), state.GetDebugMessage().empty() ? "" : ", "+state.GetDebugMessage());