Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/validation.h
// Copyright (c) 2020 The Bitcoin developers | // Copyright (c) 2020 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_AVALANCHE_VALIDATION_H | #ifndef BITCOIN_AVALANCHE_VALIDATION_H | ||||
#define BITCOIN_AVALANCHE_VALIDATION_H | #define BITCOIN_AVALANCHE_VALIDATION_H | ||||
#include <consensus/validation.h> | #include <consensus/validation.h> | ||||
namespace avalanche { | namespace avalanche { | ||||
enum class ProofValidationResult { | enum class ProofValidationResult { | ||||
NONE, | NONE = 0, | ||||
NO_STAKE, | NO_STAKE, | ||||
DUST_THRESOLD, | DUST_THRESOLD, | ||||
DUPLICATE_STAKE, | DUPLICATE_STAKE, | ||||
INVALID_SIGNATURE, | INVALID_SIGNATURE, | ||||
}; | }; | ||||
class ProofValidationState : public ValidationState { | class ProofValidationState : public ValidationState<ProofValidationResult> {}; | ||||
private: | |||||
ProofValidationResult m_result = ProofValidationResult::NONE; | |||||
public: | |||||
bool Invalid(ProofValidationResult result, | |||||
const std::string &reject_reason = "", | |||||
const std::string &debug_message = "") { | |||||
m_result = result; | |||||
ValidationState::Invalid(reject_reason, debug_message); | |||||
return false; | |||||
} | |||||
ProofValidationResult GetResult() const { return m_result; } | |||||
}; | |||||
} // namespace avalanche | } // namespace avalanche | ||||
#endif // BITCOIN_AVALANCHE_VALIDATION_H | #endif // BITCOIN_AVALANCHE_VALIDATION_H |