@@ -75,37 +75,39 @@ enum class BlockValidationResult {
75
75
* by TxValidationState and BlockValidationState for validation information on transactions
76
76
* and blocks respectively. */
77
77
template <typename Result>
78
- class ValidationState {
78
+ class ValidationState
79
+ {
79
80
private:
80
- enum mode_state {
81
- MODE_VALID , // !< everything ok
82
- MODE_INVALID , // !< network rule violation (DoS value may be set)
83
- MODE_ERROR , // !< run-time error
84
- } m_mode{MODE_VALID };
81
+ enum class ModeState {
82
+ M_VALID , // !< everything ok
83
+ M_INVALID , // !< network rule violation (DoS value may be set)
84
+ M_ERROR , // !< run-time error
85
+ } m_mode{ModeState::M_VALID };
85
86
Result m_result{};
86
87
std::string m_reject_reason;
87
88
std::string m_debug_message;
89
+
88
90
public:
89
91
bool Invalid (Result result,
90
- const std::string & reject_reason= " " ,
91
- const std::string & debug_message= " " )
92
+ const std::string& reject_reason = " " ,
93
+ const std::string& debug_message = " " )
92
94
{
93
95
m_result = result;
94
96
m_reject_reason = reject_reason;
95
97
m_debug_message = debug_message;
96
- if (m_mode != MODE_ERROR ) m_mode = MODE_INVALID ;
98
+ if (m_mode != ModeState::M_ERROR ) m_mode = ModeState::M_INVALID ;
97
99
return false ;
98
100
}
99
101
bool Error (const std::string& reject_reason)
100
102
{
101
- if (m_mode == MODE_VALID )
103
+ if (m_mode == ModeState::M_VALID )
102
104
m_reject_reason = reject_reason;
103
- m_mode = MODE_ERROR ;
105
+ m_mode = ModeState::M_ERROR ;
104
106
return false ;
105
107
}
106
- bool IsValid () const { return m_mode == MODE_VALID ; }
107
- bool IsInvalid () const { return m_mode == MODE_INVALID ; }
108
- bool IsError () const { return m_mode == MODE_ERROR ; }
108
+ bool IsValid () const { return m_mode == ModeState::M_VALID ; }
109
+ bool IsInvalid () const { return m_mode == ModeState::M_INVALID ; }
110
+ bool IsError () const { return m_mode == ModeState::M_ERROR ; }
109
111
Result GetResult () const { return m_result; }
110
112
std::string GetRejectReason () const { return m_reject_reason; }
111
113
std::string GetDebugMessage () const { return m_debug_message; }
0 commit comments