Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Go to the source code of this file.
Namespaces | |
Consensus | |
Functions | |
bool | CheckTransaction (const CTransaction &tx, CValidationState &state) |
Transaction validation functions. More... | |
bool | Consensus::CheckTxInputs (const CTransaction &tx, CValidationState &state, const CCoinsViewCache &inputs, int nSpendHeight, CAmount &txfee) |
Check whether all inputs of this transaction are valid (no double spends and amounts) This does not modify the UTXO set. More... | |
unsigned int | GetLegacySigOpCount (const CTransaction &tx) |
Auxiliary functions for transaction validation (ideally should not be exposed) More... | |
unsigned int | GetP2SHSigOpCount (const CTransaction &tx, const CCoinsViewCache &mapInputs) |
Count ECDSA signature operations in pay-to-script-hash inputs. More... | |
unsigned int | GetTransactionSigOpCount (const CTransaction &tx, const CCoinsViewCache &inputs, int flags) |
Count total signature operations for a transaction. More... | |
bool | IsFinalTx (const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) |
Check if transaction is final and can be included in a block with the specified height and time. More... | |
std::pair< int, int64_t > | CalculateSequenceLocks (const CTransaction &tx, int flags, std::vector< int > *prevHeights, const CBlockIndex &block) |
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. More... | |
bool | EvaluateSequenceLocks (const CBlockIndex &block, std::pair< int, int64_t > lockPair) |
bool | SequenceLocks (const CTransaction &tx, int flags, std::vector< int > *prevHeights, const CBlockIndex &block) |
Check if transaction is final per BIP 68 sequence numbers and can be included in a block. More... | |
Function Documentation
◆ CalculateSequenceLocks()
std::pair<int, int64_t> CalculateSequenceLocks | ( | const CTransaction & | tx, |
int | flags, | ||
std::vector< int > * | prevHeights, | ||
const CBlockIndex & | block | ||
) |
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.
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.
Definition at line 30 of file tx_verify.cpp.
References flags, CBlockIndex::GetAncestor(), CBlockIndex::GetMedianTimePast(), LOCKTIME_VERIFY_SEQUENCE, CTxIn::nSequence, CTransaction::nVersion, CTxIn::SEQUENCE_LOCKTIME_DISABLE_FLAG, CTxIn::SEQUENCE_LOCKTIME_GRANULARITY, CTxIn::SEQUENCE_LOCKTIME_MASK, CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG, and CTransaction::vin.
Referenced by CheckSequenceLocks(), and SequenceLocks().
◆ CheckTransaction()
bool CheckTransaction | ( | const CTransaction & | tx, |
CValidationState & | state | ||
) |
Transaction validation functions.
Context-independent validity checks
Definition at line 152 of file tx_verify.cpp.
References CValidationState::DoS(), GetSerializeSize(), CTransaction::IsCoinBase(), MAX_LEGACY_BLOCK_SIZE, MAX_MONEY, MAX_TX_EXTRA_PAYLOAD, MoneyRange(), CTransaction::nType, PROTOCOL_VERSION, REJECT_INVALID, SER_NETWORK, TRANSACTION_COINBASE, TRANSACTION_QUORUM_COMMITMENT, CTransaction::vExtraPayload, CTransaction::vin, and CTransaction::vout.
Referenced by AcceptToMemoryPoolWorker(), CheckBlock(), and ReadKeyValue().
◆ EvaluateSequenceLocks()
bool EvaluateSequenceLocks | ( | const CBlockIndex & | block, |
std::pair< int, int64_t > | lockPair | ||
) |
Definition at line 92 of file tx_verify.cpp.
References CBlockIndex::GetMedianTimePast(), CBlockIndex::nHeight, and CBlockIndex::pprev.
Referenced by CheckSequenceLocks(), and SequenceLocks().
◆ GetLegacySigOpCount()
unsigned int GetLegacySigOpCount | ( | const CTransaction & | tx | ) |
Auxiliary functions for transaction validation (ideally should not be exposed)
Count ECDSA signature operations the old-fashioned (pre-0.6) way
- Returns
- number of sigops this transaction's outputs will produce when spent
- See also
- CTransaction::FetchInputs
Definition at line 107 of file tx_verify.cpp.
References CTransaction::vin, and CTransaction::vout.
Referenced by CheckBlock(), ContextualCheckBlock(), BlockAssembler::CreateNewBlock(), and GetTransactionSigOpCount().
◆ GetP2SHSigOpCount()
unsigned int GetP2SHSigOpCount | ( | const CTransaction & | tx, |
const CCoinsViewCache & | mapInputs | ||
) |
Count ECDSA signature operations in pay-to-script-hash inputs.
- Parameters
-
[in] mapInputs Map of previous transactions that have outputs we're spending
- Returns
- maximum number of sigops required to validate this transaction's inputs
- See also
- CTransaction::FetchInputs
Definition at line 121 of file tx_verify.cpp.
References CCoinsViewCache::AccessCoin(), CScript::GetSigOpCount(), CTransaction::IsCoinBase(), Coin::IsSpent(), Coin::out, CTxOut::scriptPubKey, and CTransaction::vin.
Referenced by GetTransactionSigOpCount().
◆ GetTransactionSigOpCount()
unsigned int GetTransactionSigOpCount | ( | const CTransaction & | tx, |
const CCoinsViewCache & | inputs, | ||
int | flags | ||
) |
Count total signature operations for a transaction.
- Parameters
-
[in] tx Transaction for which we are counting sigops [in] inputs Map of previous transactions that have outputs we're spending [out] flags Script verification flags
- Returns
- Total signature operation count for a tx
Definition at line 138 of file tx_verify.cpp.
References flags, GetLegacySigOpCount(), GetP2SHSigOpCount(), CTransaction::IsCoinBase(), and SCRIPT_VERIFY_P2SH.
Referenced by AcceptToMemoryPoolWorker(), and CChainState::ConnectBlock().
◆ IsFinalTx()
bool IsFinalTx | ( | const CTransaction & | tx, |
int | nBlockHeight, | ||
int64_t | nBlockTime | ||
) |
Check if transaction is final and can be included in a block with the specified height and time.
Consensus critical.
Definition at line 17 of file tx_verify.cpp.
References LOCKTIME_THRESHOLD, CTransaction::nLockTime, CTxIn::SEQUENCE_FINAL, and CTransaction::vin.
Referenced by CheckFinalTx(), ContextualCheckBlock(), and BlockAssembler::TestPackageTransactions().
◆ SequenceLocks()
bool SequenceLocks | ( | const CTransaction & | tx, |
int | flags, | ||
std::vector< int > * | prevHeights, | ||
const CBlockIndex & | block | ||
) |
Check if transaction is final per BIP 68 sequence numbers and can be included in a block.
Consensus critical. Takes as input a list of heights at which tx's inputs (in order) confirmed.
Definition at line 102 of file tx_verify.cpp.
References CalculateSequenceLocks(), EvaluateSequenceLocks(), and flags.
Referenced by CChainState::ConnectBlock().