Skip to content

Commit d19c880

Browse files
jkczyzrandom-zebra
authored andcommitted
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.
1 parent 888eeac commit d19c880

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/util/validation.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
/** Convert CValidationState to a human-readable message for logging */
1313
std::string FormatStateMessage(const CValidationState& state)
1414
{
15+
if (state.IsValid()) {
16+
return "Valid";
17+
}
18+
1519
return strprintf("%s%s (code %i)",
1620
state.GetRejectReason(),
1721
state.GetDebugMessage().empty() ? "" : ", "+state.GetDebugMessage(),

0 commit comments

Comments
 (0)