Allow use of state.Invalid() for all reasons

Co-authored-by: Anthony Towns <aj@erisian.com.au>
This commit is contained in:
Matt Corallo 2019-01-20 13:21:55 +10:00 committed by Suhas Daftuar
parent 6b34bc6b6f
commit 5e78c5734b

View file

@ -84,21 +84,23 @@ public:
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;