diff options
author | Matt Corallo <git@bluematt.me> | 2019-01-18 12:59:02 +1000 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2019-05-02 15:25:43 -0400 |
commit | 12dbdd7a41bac73e51ed8f7b290b7671196bf9ea (patch) | |
tree | 1ceba963fb50fd082a7f3d6e7d094b5517b322b0 /src/consensus/validation.h | |
parent | aa502b88d10c2c3ac56d9163555849b96dc4df1e (diff) |
[refactor] Drop unused state.DoS(), state.GetDoS(), state.CorruptionPossible()
Co-authored-by: Anthony Towns <aj@erisian.com.au>
Diffstat (limited to 'src/consensus/validation.h')
-rw-r--r-- | src/consensus/validation.h | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/src/consensus/validation.h b/src/consensus/validation.h index 9583e61056..ed1b047614 100644 --- a/src/consensus/validation.h +++ b/src/consensus/validation.h @@ -80,18 +80,9 @@ private: std::string strDebugMessage; public: CValidationState() : mode(MODE_VALID), m_reason(ValidationInvalidReason::NONE), chRejectCode(0) {} - bool DoS(int level, ValidationInvalidReason reasonIn, bool ret = false, - 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="") { + unsigned int chRejectCodeIn=0, const std::string &strRejectReasonIn="", + const std::string &strDebugMessageIn="") { m_reason = reasonIn; chRejectCode = chRejectCodeIn; strRejectReason = strRejectReasonIn; @@ -116,33 +107,6 @@ public: bool IsError() const { return mode == MODE_ERROR; } - bool CorruptionPossible() const { - return m_reason == ValidationInvalidReason::BLOCK_MUTATED || m_reason == ValidationInvalidReason::TX_WITNESS_MUTATED; - } - int GetDoS() const { - switch (m_reason) { - case ValidationInvalidReason::NONE: - return 0; - case ValidationInvalidReason::CONSENSUS: - case ValidationInvalidReason::BLOCK_MUTATED: - case ValidationInvalidReason::BLOCK_INVALID_HEADER: - case ValidationInvalidReason::BLOCK_CHECKPOINT: - case ValidationInvalidReason::BLOCK_INVALID_PREV: - return 100; - case ValidationInvalidReason::BLOCK_MISSING_PREV: - return 10; - case ValidationInvalidReason::CACHED_INVALID: - case ValidationInvalidReason::RECENT_CONSENSUS_CHANGE: - case ValidationInvalidReason::BLOCK_TIME_FUTURE: - case ValidationInvalidReason::TX_NOT_STANDARD: - case ValidationInvalidReason::TX_MISSING_INPUTS: - case ValidationInvalidReason::TX_WITNESS_MUTATED: - case ValidationInvalidReason::TX_CONFLICT: - case ValidationInvalidReason::TX_MEMPOOL_POLICY: - return 0; - } - return 0; - } ValidationInvalidReason GetReason() const { return m_reason; } unsigned int GetRejectCode() const { return chRejectCode; } std::string GetRejectReason() const { return strRejectReason; } |