diff options
author | Matt Corallo <git@bluematt.me> | 2019-01-20 13:21:55 +1000 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2019-05-02 15:21:24 -0400 |
commit | 5e78c5734bb0c9aae7b0a7019a745b2d7059b3d9 (patch) | |
tree | 2f3527796d51a95a430e025cc6eab032d4636c81 /src | |
parent | 6b34bc6b6f54f85537494cbea3846d5d195a06d9 (diff) |
Allow use of state.Invalid() for all reasons
Co-authored-by: Anthony Towns <aj@erisian.com.au>
Diffstat (limited to 'src')
-rw-r--r-- | src/consensus/validation.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/consensus/validation.h b/src/consensus/validation.h index a18739135f..9583e61056 100644 --- a/src/consensus/validation.h +++ b/src/consensus/validation.h @@ -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; |