Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
transaction_tests.cpp File Reference
#include <test/data/tx_invalid.json.h>
#include <test/data/tx_valid.json.h>
#include <test/util/setup_common.h>
#include <checkqueue.h>
#include <clientversion.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/tx_check.h>
#include <consensus/tx_verify.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <key.h>
#include <policy/policy.h>
#include <policy/settings.h>
#include <primitives/transaction_identifier.h>
#include <script/interpreter.h>
#include <script/script.h>
#include <script/script_error.h>
#include <script/sigcache.h>
#include <script/sign.h>
#include <script/signingprovider.h>
#include <script/solver.h>
#include <streams.h>
#include <test/util/common.h>
#include <test/util/json.h>
#include <test/util/random.h>
#include <test/util/script.h>
#include <test/util/transaction_utils.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <validation.h>
#include <functional>
#include <map>
#include <string>
#include <boost/test/unit_test.hpp>
#include <univalue.h>
Include dependency graph for transaction_tests.cpp:

Go to the source code of this file.

Typedefs

typedef std::vector< unsigned char > valtype

Functions

script_verify_flags ParseScriptFlags (std::string strFlags)
bool CheckMapFlagNames ()
bool CheckTxScripts (const CTransaction &tx, const std::map< COutPoint, CScript > &map_prevout_scriptPubKeys, const std::map< COutPoint, int64_t > &map_prevout_values, script_verify_flags flags, const PrecomputedTransactionData &txdata, const std::string &strTest, bool expect_valid)
script_verify_flags TrimFlags (script_verify_flags flags)
script_verify_flags FillFlags (script_verify_flags flags)
std::set< script_verify_flagsExcludeIndividualFlags (script_verify_flags flags)
 BOOST_AUTO_TEST_CASE (tx_valid)
 BOOST_AUTO_TEST_CASE (tx_invalid)
 BOOST_AUTO_TEST_CASE (tx_no_inputs)
 BOOST_AUTO_TEST_CASE (tx_oversized)
 BOOST_AUTO_TEST_CASE (basic_transaction_tests)
 BOOST_AUTO_TEST_CASE (test_Get)
static void CreateCreditAndSpend (const FillableSigningProvider &keystore, const CScript &outscript, CTransactionRef &output, CMutableTransaction &input, bool success=true)
static void CheckWithFlag (const CTransactionRef &output, const CMutableTransaction &input, script_verify_flags flags, bool success)
static CScript PushAll (const std::vector< valtype > &values)
static void ReplaceRedeemScript (CScript &script, const CScript &redeemScript)
 BOOST_AUTO_TEST_CASE (test_big_witness_transaction)
SignatureData CombineSignatures (const CMutableTransaction &input1, const CMutableTransaction &input2, const CTransactionRef tx)
 BOOST_AUTO_TEST_CASE (test_witness)
 BOOST_AUTO_TEST_CASE (test_IsStandard)
 BOOST_AUTO_TEST_CASE (max_standard_legacy_sigops)
 BOOST_AUTO_TEST_CASE (checktxinputs_invalid_transactions_test)
 BOOST_AUTO_TEST_CASE (getvalueout_out_of_range_throws)
 BOOST_AUTO_TEST_CASE (spends_witness_prog)
 Sanity check the return value of SpendsNonAnchorWitnessProg for various output types.
std::vector< std::string > SplitString (std::string_view str, char sep)
template<typename T>
std::string ToString (const T &t)
 Locale-independent version of std::to_string.

Variables

static CFeeRate g_dust {DUST_RELAY_TX_FEE}
static bool g_bare_multi {DEFAULT_PERMIT_BAREMULTISIG}
static const std::map< std::string, script_verify_flag_name > & mapFlagNames = ScriptFlagNamesToEnum()

Typedef Documentation

◆ valtype

typedef std::vector<unsigned char> valtype

Definition at line 50 of file transaction_tests.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/13]

BOOST_AUTO_TEST_CASE ( basic_transaction_tests )

Definition at line 377 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/13]

BOOST_AUTO_TEST_CASE ( checktxinputs_invalid_transactions_test )

Definition at line 1118 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/13]

BOOST_AUTO_TEST_CASE ( getvalueout_out_of_range_throws )

Definition at line 1158 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/13]

BOOST_AUTO_TEST_CASE ( max_standard_legacy_sigops )

Definition at line 1023 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/13]

BOOST_AUTO_TEST_CASE ( spends_witness_prog )

Sanity check the return value of SpendsNonAnchorWitnessProg for various output types.

Definition at line 1168 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/13]

BOOST_AUTO_TEST_CASE ( test_big_witness_transaction )

Definition at line 491 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/13]

BOOST_AUTO_TEST_CASE ( test_Get )

Definition at line 392 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/13]

BOOST_AUTO_TEST_CASE ( test_IsStandard )

Definition at line 749 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/13]

BOOST_AUTO_TEST_CASE ( test_witness )

Definition at line 571 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/13]

BOOST_AUTO_TEST_CASE ( tx_invalid )

Definition at line 251 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/13]

BOOST_AUTO_TEST_CASE ( tx_no_inputs )

Definition at line 342 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/13]

BOOST_AUTO_TEST_CASE ( tx_oversized )

Definition at line 351 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/13]

BOOST_AUTO_TEST_CASE ( tx_valid )

Definition at line 162 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ CheckMapFlagNames()

bool CheckMapFlagNames ( )

Definition at line 75 of file transaction_tests.cpp.

Here is the caller graph for this function:

◆ CheckTxScripts()

bool CheckTxScripts ( const CTransaction & tx,
const std::map< COutPoint, CScript > & map_prevout_scriptPubKeys,
const std::map< COutPoint, int64_t > & map_prevout_values,
script_verify_flags flags,
const PrecomputedTransactionData & txdata,
const std::string & strTest,
bool expect_valid )

Definition at line 87 of file transaction_tests.cpp.

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

◆ CheckWithFlag()

void CheckWithFlag ( const CTransactionRef & output,
const CMutableTransaction & input,
script_verify_flags flags,
bool success )
static

Definition at line 457 of file transaction_tests.cpp.

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

◆ CombineSignatures()

SignatureData CombineSignatures ( const CMutableTransaction & input1,
const CMutableTransaction & input2,
const CTransactionRef tx )

Definition at line 562 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ CreateCreditAndSpend()

void CreateCreditAndSpend ( const FillableSigningProvider & keystore,
const CScript & outscript,
CTransactionRef & output,
CMutableTransaction & input,
bool success = true )
static

Definition at line 418 of file transaction_tests.cpp.

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

◆ ExcludeIndividualFlags()

std::set< script_verify_flags > ExcludeIndividualFlags ( script_verify_flags flags)

Definition at line 148 of file transaction_tests.cpp.

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

◆ FillFlags()

Definition at line 133 of file transaction_tests.cpp.

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

◆ ParseScriptFlags()

script_verify_flags ParseScriptFlags ( std::string strFlags)

Definition at line 57 of file transaction_tests.cpp.

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

◆ PushAll()

CScript PushAll ( const std::vector< valtype > & values)
static

Definition at line 465 of file transaction_tests.cpp.

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

◆ ReplaceRedeemScript()

void ReplaceRedeemScript ( CScript & script,
const CScript & redeemScript )
static

Definition at line 482 of file transaction_tests.cpp.

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

◆ SplitString()

std::vector< std::string > util::SplitString ( std::string_view str,
char sep )
inlinenodiscard

Definition at line 149 of file string.h.

Here is the caller graph for this function:

◆ ToString()

template<typename T>
std::string util::ToString ( const T & t)

Locale-independent version of std::to_string.

Definition at line 246 of file string.h.

Here is the caller graph for this function:

◆ TrimFlags()

Definition at line 122 of file transaction_tests.cpp.

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

Variable Documentation

◆ g_bare_multi

bool g_bare_multi {DEFAULT_PERMIT_BAREMULTISIG}
static

Definition at line 53 of file transaction_tests.cpp.

◆ g_dust

CFeeRate g_dust {DUST_RELAY_TX_FEE}
static

Definition at line 52 of file transaction_tests.cpp.

◆ mapFlagNames

const std::map<std::string, script_verify_flag_name>& mapFlagNames = ScriptFlagNamesToEnum()
static

Definition at line 55 of file transaction_tests.cpp.