diff options
author | Jeffrey Czyz <jkczyz@gmail.com> | 2019-11-08 13:22:36 -0800 |
---|---|---|
committer | Jeffrey Czyz <jkczyz@gmail.com> | 2020-02-27 17:59:07 -0800 |
commit | 0aed17ef2892478c28cd660e53223c6dd1dc0187 (patch) | |
tree | dc2290695c6d65e7917df9d83e8e4da5f5ce6e1a /src/consensus | |
parent | fe63d79eabf1a9a0084d43802620d34f383aa358 (diff) |
Refactor FormatStateMessage into ValidationState
Diffstat (limited to 'src/consensus')
-rw-r--r-- | src/consensus/validation.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/consensus/validation.h b/src/consensus/validation.h index 8a3abb31f4..4ead26a416 100644 --- a/src/consensus/validation.h +++ b/src/consensus/validation.h @@ -108,6 +108,18 @@ public: bool IsError() const { return m_mode == MODE_ERROR; } std::string GetRejectReason() const { return m_reject_reason; } std::string GetDebugMessage() const { return m_debug_message; } + std::string ToString() const + { + if (IsValid()) { + return "Valid"; + } + + if (!m_debug_message.empty()) { + return m_reject_reason + ", " + m_debug_message; + } + + return m_reject_reason; + } }; inline ValidationState::~ValidationState() {}; |