diff --git a/src/consensus/validation.h b/src/consensus/validation.h index fc9f53451..401c6e75f 100644 --- a/src/consensus/validation.h +++ b/src/consensus/validation.h @@ -1,89 +1,88 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CONSENSUS_VALIDATION_H #define BITCOIN_CONSENSUS_VALIDATION_H #include /** "reject" message codes */ static const uint8_t REJECT_MALFORMED = 0x01; static const uint8_t REJECT_INVALID = 0x10; static const uint8_t REJECT_OBSOLETE = 0x11; static const uint8_t REJECT_DUPLICATE = 0x12; static const uint8_t REJECT_NONSTANDARD = 0x40; -static const uint8_t REJECT_DUST = 0x41; static const uint8_t REJECT_INSUFFICIENTFEE = 0x42; static const uint8_t REJECT_CHECKPOINT = 0x43; /** Capture information about block/transaction validation */ class CValidationState { private: enum mode_state { MODE_VALID, //!< everything ok MODE_INVALID, //!< network rule violation (DoS value may be set) MODE_ERROR, //!< run-time error } mode; int nDoS; std::string strRejectReason; unsigned int chRejectCode; bool corruptionPossible; std::string strDebugMessage; public: CValidationState() : mode(MODE_VALID), nDoS(0), chRejectCode(0), corruptionPossible(false) {} bool DoS(int level, bool ret = false, unsigned int chRejectCodeIn = 0, const std::string &strRejectReasonIn = "", bool corruptionIn = false, const std::string &strDebugMessageIn = "") { chRejectCode = chRejectCodeIn; strRejectReason = strRejectReasonIn; corruptionPossible = corruptionIn; strDebugMessage = strDebugMessageIn; if (mode == MODE_ERROR) { return ret; } nDoS += level; mode = MODE_INVALID; return ret; } bool Invalid(bool ret = false, unsigned int _chRejectCode = 0, const std::string &_strRejectReason = "", const std::string &_strDebugMessage = "") { return DoS(0, ret, _chRejectCode, _strRejectReason, false, _strDebugMessage); } bool Error(const std::string &strRejectReasonIn) { if (mode == MODE_VALID) { strRejectReason = strRejectReasonIn; } mode = MODE_ERROR; return false; } bool IsValid() const { return mode == MODE_VALID; } bool IsInvalid() const { return mode == MODE_INVALID; } bool IsError() const { return mode == MODE_ERROR; } bool IsInvalid(int &nDoSOut) const { if (IsInvalid()) { nDoSOut = nDoS; return true; } return false; } bool CorruptionPossible() const { return corruptionPossible; } void SetCorruptionPossible() { corruptionPossible = true; } unsigned int GetRejectCode() const { return chRejectCode; } std::string GetRejectReason() const { return strRejectReason; } std::string GetDebugMessage() const { return strDebugMessage; } }; #endif // BITCOIN_CONSENSUS_VALIDATION_H diff --git a/src/version.h b/src/version.h index 3cbe33d80..3c00bb726 100644 --- a/src/version.h +++ b/src/version.h @@ -1,50 +1,47 @@ // Copyright (c) 2012-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_VERSION_H #define BITCOIN_VERSION_H /** * network protocol versioning */ static const int PROTOCOL_VERSION = 70015; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; //! In this version, 'getheaders' was introduced. static const int GETHEADERS_VERSION = 31800; //! disconnect from peers older than this proto version static const int MIN_PEER_PROTO_VERSION = GETHEADERS_VERSION; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this static const int CADDR_TIME_VERSION = 31402; //! BIP 0031, pong message, is enabled for all versions AFTER this one static const int BIP0031_VERSION = 60000; -//! "mempool" command, enhanced "getdata" behavior starts with this version -static const int MEMPOOL_GD_VERSION = 60002; - //! "filter*" commands are disabled without NODE_BLOOM after and including this //! version static const int NO_BLOOM_VERSION = 70011; //! "sendheaders" command and announcing blocks with headers starts with this //! version static const int SENDHEADERS_VERSION = 70012; //! "feefilter" tells peers to filter invs to you by fee starts with this //! version static const int FEEFILTER_VERSION = 70013; //! short-id-based block download starts with this version static const int SHORT_IDS_BLOCKS_VERSION = 70014; //! not banning for invalid compact blocks starts with this version static const int INVALID_CB_NO_BAN_VERSION = 70015; #endif // BITCOIN_VERSION_H