Changeset View
Changeset View
Standalone View
Standalone View
src/consensus/tx_verify.h
// Copyright (c) 2018 The Bitcoin developers | // Copyright (c) 2018 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_CONSENSUS_TX_VERIFY_H | #ifndef BITCOIN_CONSENSUS_TX_VERIFY_H | ||||
#define BITCOIN_CONSENSUS_TX_VERIFY_H | #define BITCOIN_CONSENSUS_TX_VERIFY_H | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <vector> | #include <vector> | ||||
struct Amount; | struct Amount; | ||||
class CBlockIndex; | class CBlockIndex; | ||||
class CCoinsViewCache; | class CCoinsViewCache; | ||||
class Config; | |||||
class CTransaction; | class CTransaction; | ||||
class CValidationState; | class CValidationState; | ||||
/** | /** | ||||
* Context-independent validity checks for coinbase and non-coinbase | * Context-independent validity checks for coinbase and non-coinbase | ||||
* transactions. | * transactions. | ||||
*/ | */ | ||||
bool CheckRegularTransaction(const CTransaction &tx, CValidationState &state); | bool CheckRegularTransaction(const CTransaction &tx, CValidationState &state); | ||||
bool CheckCoinbase(const CTransaction &tx, CValidationState &state); | bool CheckCoinbase(const CTransaction &tx, CValidationState &state); | ||||
namespace Consensus { | namespace Consensus { | ||||
struct Params; | |||||
/** | /** | ||||
* Check whether all inputs of this transaction are valid (no double spends and | * Check whether all inputs of this transaction are valid (no double spends and | ||||
* amounts). This does not modify the UTXO set. This does not check scripts and | * amounts). This does not modify the UTXO set. This does not check scripts and | ||||
* sigs. | * sigs. | ||||
* @param[out] txfee Set to the transaction fee if successful. | * @param[out] txfee Set to the transaction fee if successful. | ||||
* Preconditions: tx.IsCoinBase() is false. | * Preconditions: tx.IsCoinBase() is false. | ||||
*/ | */ | ||||
bool CheckTxInputs(const CTransaction &tx, CValidationState &state, | bool CheckTxInputs(const CTransaction &tx, CValidationState &state, | ||||
const CCoinsViewCache &inputs, int nSpendHeight, | const CCoinsViewCache &inputs, int nSpendHeight, | ||||
Amount &txfee); | Amount &txfee); | ||||
} // namespace Consensus | } // namespace Consensus | ||||
/** | /** | ||||
* Context dependent validity checks for non coinbase transactions. This | * Context dependent validity checks for non coinbase transactions. This | ||||
* doesn't check the validity of the transaction against the UTXO set, but | * doesn't check the validity of the transaction against the UTXO set, but | ||||
* simply characteristic that are suceptible to change over time such as feature | * simply characteristic that are suceptible to change over time such as feature | ||||
* activation/deactivation and CLTV. | * activation/deactivation and CLTV. | ||||
*/ | */ | ||||
bool ContextualCheckTransaction(const Config &config, const CTransaction &tx, | bool ContextualCheckTransaction(const Consensus::Params ¶ms, | ||||
CValidationState &state, int nHeight, | const CTransaction &tx, CValidationState &state, | ||||
int64_t nLockTimeCutoff, | int nHeight, int64_t nLockTimeCutoff, | ||||
int64_t nMedianTimePast); | int64_t nMedianTimePast); | ||||
/** | /** | ||||
* Calculates the block height and previous block's median time past at which | * Calculates the block height and previous block's median time past at which | ||||
* the transaction will be considered final in the context of BIP 68. | * the transaction will be considered final in the context of BIP 68. | ||||
* Also removes from the vector of input heights any entries which did not | * Also removes from the vector of input heights any entries which did not | ||||
* correspond to sequence locked inputs as they do not affect the calculation. | * correspond to sequence locked inputs as they do not affect the calculation. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |