Bitcoin Core 30.99.0
P2P Digital Currency
Typedefs | Functions | Variables
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/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/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 (spends_witness_prog)
 Sanity check the return value of SpendsNonAnchorWitnessProg for various output types. More...
 

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 = g_verify_flag_names
 

Typedef Documentation

◆ valtype

typedef std::vector<unsigned char> valtype

Definition at line 48 of file transaction_tests.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/11]

BOOST_AUTO_TEST_CASE ( basic_transaction_tests  )

Definition at line 375 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/11]

BOOST_AUTO_TEST_CASE ( max_standard_legacy_sigops  )

Definition at line 1022 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/11]

BOOST_AUTO_TEST_CASE ( spends_witness_prog  )

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

Definition at line 1118 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/11]

BOOST_AUTO_TEST_CASE ( test_big_witness_transaction  )

Definition at line 490 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/11]

BOOST_AUTO_TEST_CASE ( test_Get  )

Definition at line 391 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/11]

BOOST_AUTO_TEST_CASE ( test_IsStandard  )

Definition at line 748 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/11]

BOOST_AUTO_TEST_CASE ( test_witness  )

Definition at line 570 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/11]

BOOST_AUTO_TEST_CASE ( tx_invalid  )

Definition at line 249 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/11]

BOOST_AUTO_TEST_CASE ( tx_no_inputs  )

Definition at line 340 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/11]

BOOST_AUTO_TEST_CASE ( tx_oversized  )

Definition at line 349 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/11]

BOOST_AUTO_TEST_CASE ( tx_valid  )

Definition at line 160 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ CheckMapFlagNames()

bool CheckMapFlagNames ( )

Definition at line 73 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 85 of file transaction_tests.cpp.

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

◆ CheckWithFlag()

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

Definition at line 456 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 561 of file transaction_tests.cpp.

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

◆ CreateCreditAndSpend()

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

Definition at line 417 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 146 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 131 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 55 of file transaction_tests.cpp.

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

◆ PushAll()

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

Definition at line 464 of file transaction_tests.cpp.

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

◆ ReplaceRedeemScript()

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

Definition at line 481 of file transaction_tests.cpp.

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

◆ TrimFlags()

Definition at line 120 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 51 of file transaction_tests.cpp.

◆ g_dust

CFeeRate g_dust {DUST_RELAY_TX_FEE}
static

Definition at line 50 of file transaction_tests.cpp.

◆ mapFlagNames

const std::map<std::string, script_verify_flag_name>& mapFlagNames = g_verify_flag_names
static

Definition at line 53 of file transaction_tests.cpp.