diff --git a/src/consensus/validation.h b/src/consensus/validation.h --- a/src/consensus/validation.h +++ b/src/consensus/validation.h @@ -85,11 +85,11 @@ */ template class ValidationState { private: - enum mode_state { - MODE_VALID, //!< everything ok - MODE_INVALID, //!< network rule violation (DoS value may be set) - MODE_ERROR, //!< run-time error - } m_mode{MODE_VALID}; + enum class ModeState { + M_VALID, //!< everything ok + M_INVALID, //!< network rule violation (DoS value may be set) + M_ERROR, //!< run-time error + } m_mode{ModeState::M_VALID}; Result m_result{}; std::string m_reject_reason; std::string m_debug_message; @@ -100,22 +100,22 @@ m_result = result; m_reject_reason = reject_reason; m_debug_message = debug_message; - if (m_mode != MODE_ERROR) { - m_mode = MODE_INVALID; + if (m_mode != ModeState::M_ERROR) { + m_mode = ModeState::M_INVALID; } return false; } bool Error(const std::string &reject_reason) { - if (m_mode == MODE_VALID) { + if (m_mode == ModeState::M_VALID) { m_reject_reason = reject_reason; } - m_mode = MODE_ERROR; + m_mode = ModeState::M_ERROR; return false; } - bool IsValid() const { return m_mode == MODE_VALID; } - bool IsInvalid() const { return m_mode == MODE_INVALID; } - bool IsError() const { return m_mode == MODE_ERROR; } + bool IsValid() const { return m_mode == ModeState::M_VALID; } + bool IsInvalid() const { return m_mode == ModeState::M_INVALID; } + bool IsError() const { return m_mode == ModeState::M_ERROR; } Result GetResult() const { return m_result; } std::string GetRejectReason() const { return m_reject_reason; } std::string GetDebugMessage() const { return m_debug_message; } diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4079,8 +4079,10 @@ if (!CheckBlockHeader(block, state, chainparams.GetConsensus(), BlockValidationOptions(config))) { - return error("%s: Consensus::CheckBlockHeader: %s, %s", __func__, - hash.ToString(), state.ToString()); + LogPrint(BCLog::VALIDATION, + "%s: Consensus::CheckBlockHeader: %s, %s\n", __func__, + hash.ToString(), state.ToString()); + return false; } // Get prev block index