Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | |||||
extern bool fCheckpointsEnabled; | extern bool fCheckpointsEnabled; | ||||
extern size_t nCoinCacheUsage; | extern size_t nCoinCacheUsage; | ||||
/** A fee rate smaller than this is considered zero fee (for relaying, mining | /** A fee rate smaller than this is considered zero fee (for relaying, mining | ||||
* and transaction creation) */ | * and transaction creation) */ | ||||
extern CFeeRate minRelayTxFee; | extern CFeeRate minRelayTxFee; | ||||
/** Absolute maximum transaction fee (in satoshis) used by wallet and mempool | /** Absolute maximum transaction fee (in satoshis) used by wallet and mempool | ||||
* (rejects high fee in sendrawtransaction) */ | * (rejects high fee in sendrawtransaction) */ | ||||
extern CAmount maxTxFee; | extern Amount maxTxFee; | ||||
/** If the tip is older than this (in seconds), the node is considered to be in | /** If the tip is older than this (in seconds), the node is considered to be in | ||||
* initial block download. */ | * initial block download. */ | ||||
extern int64_t nMaxTipAge; | extern int64_t nMaxTipAge; | ||||
/** Block hash whose ancestors we will assume to have valid scripts without | /** Block hash whose ancestors we will assume to have valid scripts without | ||||
* checking them. */ | * checking them. */ | ||||
extern uint256 hashAssumeValid; | extern uint256 hashAssumeValid; | ||||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | |||||
/** Retrieve a transaction (from memory pool, or from disk, if possible) */ | /** Retrieve a transaction (from memory pool, or from disk, if possible) */ | ||||
bool GetTransaction(const Config &config, const uint256 &hash, | bool GetTransaction(const Config &config, const uint256 &hash, | ||||
CTransactionRef &tx, uint256 &hashBlock, | CTransactionRef &tx, uint256 &hashBlock, | ||||
bool fAllowSlow = false); | bool fAllowSlow = false); | ||||
/** Find the best known block, and make it the tip of the block chain */ | /** Find the best known block, and make it the tip of the block chain */ | ||||
bool ActivateBestChain( | bool ActivateBestChain( | ||||
const Config &config, CValidationState &state, | const Config &config, CValidationState &state, | ||||
std::shared_ptr<const CBlock> pblock = std::shared_ptr<const CBlock>()); | std::shared_ptr<const CBlock> pblock = std::shared_ptr<const CBlock>()); | ||||
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params &consensusParams); | Amount GetBlockSubsidy(int nHeight, const Consensus::Params &consensusParams); | ||||
/** Guess verification progress (as a fraction between 0.0=genesis and | /** Guess verification progress (as a fraction between 0.0=genesis and | ||||
* 1.0=current tip). */ | * 1.0=current tip). */ | ||||
double GuessVerificationProgress(const ChainTxData &data, CBlockIndex *pindex); | double GuessVerificationProgress(const ChainTxData &data, CBlockIndex *pindex); | ||||
/** | /** | ||||
* Prune block and undo files (blk???.dat and undo???.dat) so that the disk | * Prune block and undo files (blk???.dat and undo???.dat) so that the disk | ||||
* space used is less than a user-defined target. The user sets the target (in | * space used is less than a user-defined target. The user sets the target (in | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
/** (try to) add transaction to memory pool | /** (try to) add transaction to memory pool | ||||
* plTxnReplaced will be appended to with all transactions replaced from mempool | * plTxnReplaced will be appended to with all transactions replaced from mempool | ||||
* **/ | * **/ | ||||
bool AcceptToMemoryPool(const Config &config, CTxMemPool &pool, | bool AcceptToMemoryPool(const Config &config, CTxMemPool &pool, | ||||
CValidationState &state, const CTransactionRef &tx, | CValidationState &state, const CTransactionRef &tx, | ||||
bool fLimitFree, bool *pfMissingInputs, | bool fLimitFree, bool *pfMissingInputs, | ||||
std::list<CTransactionRef> *plTxnReplaced = nullptr, | std::list<CTransactionRef> *plTxnReplaced = nullptr, | ||||
bool fOverrideMempoolLimit = false, | bool fOverrideMempoolLimit = false, | ||||
const CAmount nAbsurdFee = 0); | const Amount nAbsurdFee = Amount(0)); | ||||
/** Convert CValidationState to a human-readable message for logging */ | /** Convert CValidationState to a human-readable message for logging */ | ||||
std::string FormatStateMessage(const CValidationState &state); | std::string FormatStateMessage(const CValidationState &state); | ||||
/** Get the BIP9 state for a given deployment at the current tip. */ | /** Get the BIP9 state for a given deployment at the current tip. */ | ||||
ThresholdState VersionBitsTipState(const Consensus::Params ¶ms, | ThresholdState VersionBitsTipState(const Consensus::Params ¶ms, | ||||
Consensus::DeploymentPos pos); | Consensus::DeploymentPos pos); | ||||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Closure representing one script verification. | * Closure representing one script verification. | ||||
* Note that this stores references to the spending transaction. | * Note that this stores references to the spending transaction. | ||||
*/ | */ | ||||
class CScriptCheck { | class CScriptCheck { | ||||
private: | private: | ||||
CScript scriptPubKey; | CScript scriptPubKey; | ||||
CAmount amount; | Amount amount; | ||||
const CTransaction *ptxTo; | const CTransaction *ptxTo; | ||||
unsigned int nIn; | unsigned int nIn; | ||||
uint32_t nFlags; | uint32_t 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), txdata() {} | error(SCRIPT_ERR_UNKNOWN_ERROR), txdata() {} | ||||
CScriptCheck(const CScript &scriptPubKeyIn, const CAmount amountIn, | CScriptCheck(const CScript &scriptPubKeyIn, const Amount amountIn, | ||||
const CTransaction &txToIn, unsigned int nInIn, | const CTransaction &txToIn, unsigned int nInIn, | ||||
uint32_t nFlagsIn, bool cacheIn, | uint32_t nFlagsIn, bool cacheIn, | ||||
const PrecomputedTransactionData &txdataIn) | const PrecomputedTransactionData &txdataIn) | ||||
: scriptPubKey(scriptPubKeyIn), amount(amountIn), ptxTo(&txToIn), | : scriptPubKey(scriptPubKeyIn), amount(amountIn), ptxTo(&txToIn), | ||||
nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), | nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), | ||||
error(SCRIPT_ERR_UNKNOWN_ERROR), txdata(txdataIn) {} | error(SCRIPT_ERR_UNKNOWN_ERROR), txdata(txdataIn) {} | ||||
bool operator()(); | bool operator()(); | ||||
▲ Show 20 Lines • Show All 154 Lines • Show Last 20 Lines |