Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 436 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Check whether all inputs of this transaction are valid (no double spends, | * Check whether all inputs of this transaction are valid (no double spends, | ||||
* scripts & sigs, amounts). This does not modify the UTXO set. If pvChecks is | * scripts & sigs, amounts). This does not modify the UTXO set. If pvChecks is | ||||
* not NULL, script checks are pushed onto it instead of being performed inline. | * not NULL, script checks are pushed onto it instead of being performed inline. | ||||
*/ | */ | ||||
bool CheckInputs(const CTransaction &tx, CValidationState &state, | bool CheckInputs(const CTransaction &tx, CValidationState &state, | ||||
const CCoinsViewCache &view, bool fScriptChecks, | const CCoinsViewCache &view, bool fScriptChecks, | ||||
unsigned int flags, bool cacheStore, | unsigned int flags, bool cacheStore, | ||||
PrecomputedTransactionData &txdata, | const PrecomputedTransactionData &txdata, | ||||
std::vector<CScriptCheck> *pvChecks = NULL); | std::vector<CScriptCheck> *pvChecks = nullptr); | ||||
/** Apply the effects of this transaction on the UTXO set represented by view */ | /** Apply the effects of this transaction on the UTXO set represented by view */ | ||||
void UpdateCoins(const CTransaction &tx, CCoinsViewCache &inputs, int nHeight); | void UpdateCoins(const CTransaction &tx, CCoinsViewCache &inputs, int nHeight); | ||||
void UpdateCoins(const CTransaction &tx, CCoinsViewCache &inputs, | void UpdateCoins(const CTransaction &tx, CCoinsViewCache &inputs, | ||||
CTxUndo &txundo, int nHeight); | CTxUndo &txundo, int nHeight); | ||||
/** Transaction validation functions */ | /** Transaction validation functions */ | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
private: | private: | ||||
CScript scriptPubKey; | CScript scriptPubKey; | ||||
CAmount amount; | CAmount amount; | ||||
const CTransaction *ptxTo; | const CTransaction *ptxTo; | ||||
unsigned int nIn; | unsigned int nIn; | ||||
unsigned int nFlags; | unsigned int nFlags; | ||||
bool cacheStore; | bool cacheStore; | ||||
ScriptError error; | ScriptError error; | ||||
PrecomputedTransactionData *txdata; | PrecomputedTransactionData txdata; | ||||
public: | public: | ||||
CScriptCheck() | CScriptCheck() | ||||
: amount(0), ptxTo(0), nIn(0), nFlags(0), cacheStore(false), | : amount(0), ptxTo(0), nIn(0), nFlags(0), cacheStore(false), | ||||
error(SCRIPT_ERR_UNKNOWN_ERROR) {} | error(SCRIPT_ERR_UNKNOWN_ERROR), txdata() {} | ||||
CScriptCheck(const CCoins &txFromIn, const CTransaction &txToIn, | CScriptCheck(const CCoins &txFromIn, const CTransaction &txToIn, | ||||
unsigned int nInIn, unsigned int nFlagsIn, bool cacheIn, | unsigned int nInIn, unsigned int nFlagsIn, bool cacheIn, | ||||
PrecomputedTransactionData *txdataIn) | const PrecomputedTransactionData &txdataIn) | ||||
: scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey), | : scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey), | ||||
amount(txFromIn.vout[txToIn.vin[nInIn].prevout.n].nValue), | amount(txFromIn.vout[txToIn.vin[nInIn].prevout.n].nValue), | ||||
ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), | ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), | ||||
error(SCRIPT_ERR_UNKNOWN_ERROR), txdata(txdataIn) {} | error(SCRIPT_ERR_UNKNOWN_ERROR), txdata(txdataIn) {} | ||||
bool operator()(); | bool operator()(); | ||||
void swap(CScriptCheck &check) { | void swap(CScriptCheck &check) { | ||||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | |||||
extern VersionBitsCache versionbitscache; | extern VersionBitsCache versionbitscache; | ||||
/** | /** | ||||
* Determine what nVersion a new block should use. | * Determine what nVersion a new block should use. | ||||
*/ | */ | ||||
int32_t ComputeBlockVersion(const CBlockIndex *pindexPrev, | int32_t ComputeBlockVersion(const CBlockIndex *pindexPrev, | ||||
const Consensus::Params ¶ms); | const Consensus::Params ¶ms); | ||||
/** Reject codes greater or equal to this can be returned by AcceptToMemPool | /** | ||||
* for transactions, to signal internal conditions. They cannot and should not | * Reject codes greater or equal to this can be returned by AcceptToMemPool for | ||||
* be sent over the P2P network. | * transactions, to signal internal conditions. They cannot and should not be | ||||
* sent over the P2P network. | |||||
*/ | */ | ||||
static const unsigned int REJECT_INTERNAL = 0x100; | static const unsigned int REJECT_INTERNAL = 0x100; | ||||
/** Too high fee. Can not be triggered by P2P transactions */ | /** Too high fee. Can not be triggered by P2P transactions */ | ||||
static const unsigned int REJECT_HIGHFEE = 0x100; | static const unsigned int REJECT_HIGHFEE = 0x100; | ||||
/** Transaction is already known (either in mempool or blockchain) */ | /** Transaction is already known (either in mempool or blockchain) */ | ||||
static const unsigned int REJECT_ALREADY_KNOWN = 0x101; | static const unsigned int REJECT_ALREADY_KNOWN = 0x101; | ||||
/** Transaction conflicts with a transaction already known */ | /** Transaction conflicts with a transaction already known */ | ||||
static const unsigned int REJECT_CONFLICT = 0x102; | static const unsigned int REJECT_CONFLICT = 0x102; | ||||
Show All 11 Lines |