mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Refactor FormatStateMessage for clarity
All cases of CValidationState were condensed into one strprintf call. This is no longer suitable as more cases are added (e.g., IsValid).
This commit is contained in:
parent
72f3227c83
commit
6edebacb21
@ -8,16 +8,18 @@
|
||||
#include <consensus/validation.h>
|
||||
#include <tinyformat.h>
|
||||
|
||||
/** 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());
|
||||
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";
|
||||
|
Loading…
Reference in New Issue
Block a user