@@ -85,42 +85,34 @@ class ValidationState {
85
85
MODE_VALID, // !< everything ok
86
86
MODE_INVALID, // !< network rule violation (DoS value may be set)
87
87
MODE_ERROR, // !< run-time error
88
- } mode ;
89
- std::string strRejectReason ;
90
- std::string strDebugMessage ;
88
+ } m_mode ;
89
+ std::string m_reject_reason ;
90
+ std::string m_debug_message ;
91
91
protected:
92
- bool Invalid (bool ret = false ,
93
- const std::string &strRejectReasonIn=" " ,
94
- const std::string &strDebugMessageIn=" " ) {
95
- strRejectReason = strRejectReasonIn;
96
- strDebugMessage = strDebugMessageIn;
97
- if (mode == MODE_ERROR)
98
- return ret;
99
- mode = MODE_INVALID;
100
- return ret;
92
+ void Invalid (const std::string &reject_reason=" " ,
93
+ const std::string &debug_message=" " )
94
+ {
95
+ m_reject_reason = reject_reason;
96
+ m_debug_message = debug_message;
97
+ if (m_mode != MODE_ERROR) m_mode = MODE_INVALID;
101
98
}
102
99
public:
103
100
// ValidationState is abstract. Have a pure virtual destructor.
104
101
virtual ~ValidationState () = 0 ;
105
102
106
- ValidationState () : mode(MODE_VALID) {}
107
- bool Error (const std::string& strRejectReasonIn) {
108
- if (mode == MODE_VALID)
109
- strRejectReason = strRejectReasonIn;
110
- mode = MODE_ERROR;
103
+ ValidationState () : m_mode(MODE_VALID) {}
104
+ bool Error (const std::string& reject_reason)
105
+ {
106
+ if (m_mode == MODE_VALID)
107
+ m_reject_reason = reject_reason;
108
+ m_mode = MODE_ERROR;
111
109
return false ;
112
110
}
113
- bool IsValid () const {
114
- return mode == MODE_VALID;
115
- }
116
- bool IsInvalid () const {
117
- return mode == MODE_INVALID;
118
- }
119
- bool IsError () const {
120
- return mode == MODE_ERROR;
121
- }
122
- std::string GetRejectReason () const { return strRejectReason; }
123
- std::string GetDebugMessage () const { return strDebugMessage; }
111
+ bool IsValid () const { return m_mode == MODE_VALID; }
112
+ bool IsInvalid () const { return m_mode == MODE_INVALID; }
113
+ bool IsError () const { return m_mode == MODE_ERROR; }
114
+ std::string GetRejectReason () const { return m_reject_reason; }
115
+ std::string GetDebugMessage () const { return m_debug_message; }
124
116
};
125
117
126
118
inline ValidationState::~ValidationState () {};
@@ -130,10 +122,12 @@ class TxValidationState : public ValidationState {
130
122
TxValidationResult m_result;
131
123
public:
132
124
bool Invalid (TxValidationResult result, bool ret = false ,
133
- const std::string &_strRejectReason=" " ,
134
- const std::string &_strDebugMessage=" " ) {
125
+ const std::string &reject_reason=" " ,
126
+ const std::string &debug_message=" " )
127
+ {
135
128
m_result = result;
136
- return ValidationState::Invalid (ret, _strRejectReason, _strDebugMessage);
129
+ ValidationState::Invalid (reject_reason, debug_message);
130
+ return ret;
137
131
}
138
132
TxValidationResult GetResult () const { return m_result; }
139
133
};
@@ -143,10 +137,11 @@ class BlockValidationState : public ValidationState {
143
137
BlockValidationResult m_result;
144
138
public:
145
139
bool Invalid (BlockValidationResult result, bool ret = false ,
146
- const std::string &_strRejectReason =" " ,
147
- const std::string &_strDebugMessage =" " ) {
140
+ const std::string &reject_reason =" " ,
141
+ const std::string &debug_message =" " ) {
148
142
m_result = result;
149
- return ValidationState::Invalid (ret, _strRejectReason, _strDebugMessage);
143
+ ValidationState::Invalid (reject_reason, debug_message);
144
+ return ret;
150
145
}
151
146
BlockValidationResult GetResult () const { return m_result; }
152
147
};
0 commit comments