Skip to content

Commit

Permalink
Allow use of state.Invalid() for all reasons
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Towns <aj@erisian.com.au>
  • Loading branch information
2 people authored and sdaftuar committed May 2, 2019
1 parent 6b34bc6 commit 5e78c57
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/consensus/validation.h
Expand Up @@ -84,21 +84,23 @@ class CValidationState {
unsigned int chRejectCodeIn=0, const std::string &strRejectReasonIn="",
bool corruptionPossibleIn=false,
const std::string &strDebugMessageIn="") {
ret = Invalid(reasonIn, ret, chRejectCodeIn, strRejectReasonIn, strDebugMessageIn);
assert(level == GetDoS());
assert(corruptionPossibleIn == CorruptionPossible());
return ret;
}
bool Invalid(ValidationInvalidReason reasonIn, bool ret = false,
unsigned int chRejectCodeIn=0, const std::string &strRejectReasonIn="",
const std::string &strDebugMessageIn="") {
m_reason = reasonIn;
chRejectCode = chRejectCodeIn;
strRejectReason = strRejectReasonIn;
strDebugMessage = strDebugMessageIn;
assert(corruptionPossibleIn == CorruptionPossible());
if (mode == MODE_ERROR)
return ret;
mode = MODE_INVALID;
return ret;
}
bool Invalid(ValidationInvalidReason _reason, bool ret = false,
unsigned int _chRejectCode=0, const std::string &_strRejectReason="",
const std::string &_strDebugMessage="") {
return DoS(0, _reason, ret, _chRejectCode, _strRejectReason, false, _strDebugMessage);
}
bool Error(const std::string& strRejectReasonIn) {
if (mode == MODE_VALID)
strRejectReason = strRejectReasonIn;
Expand Down

0 comments on commit 5e78c57

Please sign in to comment.