Bitcoin Core  27.99.0
P2P Digital Currency
Functions
tx_verify.cpp File Reference
#include <consensus/tx_verify.h>
#include <chain.h>
#include <coins.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <primitives/transaction.h>
#include <script/interpreter.h>
#include <util/check.h>
#include <util/moneystr.h>
Include dependency graph for tx_verify.cpp:

Go to the source code of this file.

Functions

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...
 
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 &inputs)
 Count ECDSA signature operations in pay-to-script-hash inputs. More...
 
int64_t GetTransactionSigOpCost (const CTransaction &tx, const CCoinsViewCache &inputs, uint32_t flags)
 Compute total signature operation cost of a transaction. 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.

For each input that is not sequence locked, the corresponding entries in prevHeights are set to 0 as they do not affect the calculation.

Definition at line 39 of file tx_verify.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EvaluateSequenceLocks()

bool EvaluateSequenceLocks ( const CBlockIndex block,
std::pair< int, int64_t >  lockPair 
)

Definition at line 101 of file tx_verify.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 116 of file tx_verify.cpp.

Here is the caller graph for this function:

◆ GetP2SHSigOpCount()

unsigned int GetP2SHSigOpCount ( const CTransaction tx,
const CCoinsViewCache mapInputs 
)

Count ECDSA signature operations in pay-to-script-hash inputs.

Parameters
[in]mapInputsMap 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 130 of file tx_verify.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTransactionSigOpCost()

int64_t GetTransactionSigOpCost ( const CTransaction tx,
const CCoinsViewCache inputs,
uint32_t  flags 
)

Compute total signature operation cost of a transaction.

Parameters
[in]txTransaction for which we are computing the cost
[in]inputsMap of previous transactions that have outputs we're spending
[in]flagsScript verification flags
Returns
Total signature operation cost of tx

Definition at line 147 of file tx_verify.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Here is the caller graph for this function:

◆ 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 111 of file tx_verify.cpp.

Here is the call graph for this function: