diff options
author | Jeffrey Czyz <jkczyz@gmail.com> | 2020-01-03 11:32:22 -0800 |
---|---|---|
committer | Jeffrey Czyz <jkczyz@gmail.com> | 2020-01-03 11:37:26 -0800 |
commit | 72f3227c83810936e7a334304e5fd7c6dab8e91b (patch) | |
tree | a8602fb4ba8ad989b38189b42e78b6eec7c1cfe1 /src | |
parent | 428ac70095253225f64462ee15c595644747f376 (diff) | |
download | bitcoin-72f3227c83810936e7a334304e5fd7c6dab8e91b.tar.xz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/util/validation.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util/validation.cpp b/src/util/validation.cpp index bd52f57751..603db51d45 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()); |