danicoin/src/CryptoNoteCore/ITransactionValidator.h
2016-01-18 15:33:29 +00:00

40 lines
1,005 B
C++

// Copyright (c) 2011-2016 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#pragma once
#include "CryptoNoteCore/CryptoNoteBasic.h"
namespace CryptoNote {
struct BlockInfo {
uint32_t height;
Crypto::Hash id;
BlockInfo() {
clear();
}
void clear() {
height = 0;
id = CryptoNote::NULL_HASH;
}
bool empty() const {
return id == CryptoNote::NULL_HASH;
}
};
class ITransactionValidator {
public:
virtual ~ITransactionValidator() {}
virtual bool checkTransactionInputs(const CryptoNote::Transaction& tx, BlockInfo& maxUsedBlock) = 0;
virtual bool checkTransactionInputs(const CryptoNote::Transaction& tx, BlockInfo& maxUsedBlock, BlockInfo& lastFailed) = 0;
virtual bool haveSpentKeyImages(const CryptoNote::Transaction& tx) = 0;
virtual bool checkTransactionSize(size_t blobSize) = 0;
};
}