Bitcoin Core 28.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/validation.h>
#include <core_io.h>
#include <key.h>
#include <policy/policy.h>
#include <policy/settings.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 <util/transaction_identifier.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

unsigned int ParseScriptFlags (std::string strFlags)
 
bool CheckMapFlagNames ()
 
std::string FormatScriptFlags (unsigned int flags)
 
bool CheckTxScripts (const CTransaction &tx, const std::map< COutPoint, CScript > &map_prevout_scriptPubKeys, const std::map< COutPoint, int64_t > &map_prevout_values, unsigned int flags, const PrecomputedTransactionData &txdata, const std::string &strTest, bool expect_valid)
 
unsigned int TrimFlags (unsigned int flags)
 
unsigned int FillFlags (unsigned int flags)
 
std::set< unsigned int > ExcludeIndividualFlags (unsigned int 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, uint32_t 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)
 

Variables

static CFeeRate g_dust {DUST_RELAY_TX_FEE}
 
static bool g_bare_multi {DEFAULT_PERMIT_BAREMULTISIG}
 
static std::map< std::string, unsigned int > mapFlagNames
 

Typedef Documentation

◆ valtype

typedef std::vector<unsigned char> valtype

Definition at line 46 of file transaction_tests.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/9]

BOOST_AUTO_TEST_CASE ( basic_transaction_tests  )

Definition at line 409 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/9]

BOOST_AUTO_TEST_CASE ( test_big_witness_transaction  )

Definition at line 524 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/9]

BOOST_AUTO_TEST_CASE ( test_Get  )

Definition at line 425 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/9]

BOOST_AUTO_TEST_CASE ( test_IsStandard  )

Definition at line 782 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/9]

BOOST_AUTO_TEST_CASE ( test_witness  )

Definition at line 604 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/9]

BOOST_AUTO_TEST_CASE ( tx_invalid  )

Definition at line 283 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/9]

BOOST_AUTO_TEST_CASE ( tx_no_inputs  )

Definition at line 374 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/9]

BOOST_AUTO_TEST_CASE ( tx_oversized  )

Definition at line 383 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/9]

BOOST_AUTO_TEST_CASE ( tx_valid  )

Definition at line 194 of file transaction_tests.cpp.

Here is the call graph for this function:

◆ CheckMapFlagNames()

bool CheckMapFlagNames ( )

Definition at line 91 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,
unsigned int  flags,
const PrecomputedTransactionData txdata,
const std::string &  strTest,
bool  expect_valid 
)

Definition at line 119 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,
uint32_t  flags,
bool  success 
)
static

Definition at line 490 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 595 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 451 of file transaction_tests.cpp.

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

◆ ExcludeIndividualFlags()

std::set< unsigned int > ExcludeIndividualFlags ( unsigned int  flags)

Definition at line 180 of file transaction_tests.cpp.

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

◆ FillFlags()

unsigned int FillFlags ( unsigned int  flags)

Definition at line 165 of file transaction_tests.cpp.

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

◆ FormatScriptFlags()

std::string FormatScriptFlags ( unsigned int  flags)

Definition at line 100 of file transaction_tests.cpp.

◆ ParseScriptFlags()

unsigned int ParseScriptFlags ( std::string  strFlags)

Definition at line 75 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 498 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 515 of file transaction_tests.cpp.

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

◆ TrimFlags()

unsigned int TrimFlags ( unsigned int  flags)

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

◆ g_dust

CFeeRate g_dust {DUST_RELAY_TX_FEE}
static

Definition at line 48 of file transaction_tests.cpp.

◆ mapFlagNames

std::map<std::string, unsigned int> mapFlagNames
static
Initial value:
= {
{std::string("P2SH"), (unsigned int)SCRIPT_VERIFY_P2SH},
{std::string("STRICTENC"), (unsigned int)SCRIPT_VERIFY_STRICTENC},
{std::string("DERSIG"), (unsigned int)SCRIPT_VERIFY_DERSIG},
{std::string("LOW_S"), (unsigned int)SCRIPT_VERIFY_LOW_S},
{std::string("SIGPUSHONLY"), (unsigned int)SCRIPT_VERIFY_SIGPUSHONLY},
{std::string("MINIMALDATA"), (unsigned int)SCRIPT_VERIFY_MINIMALDATA},
{std::string("NULLDUMMY"), (unsigned int)SCRIPT_VERIFY_NULLDUMMY},
{std::string("DISCOURAGE_UPGRADABLE_NOPS"), (unsigned int)SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS},
{std::string("CLEANSTACK"), (unsigned int)SCRIPT_VERIFY_CLEANSTACK},
{std::string("MINIMALIF"), (unsigned int)SCRIPT_VERIFY_MINIMALIF},
{std::string("NULLFAIL"), (unsigned int)SCRIPT_VERIFY_NULLFAIL},
{std::string("CHECKLOCKTIMEVERIFY"), (unsigned int)SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY},
{std::string("CHECKSEQUENCEVERIFY"), (unsigned int)SCRIPT_VERIFY_CHECKSEQUENCEVERIFY},
{std::string("WITNESS"), (unsigned int)SCRIPT_VERIFY_WITNESS},
{std::string("DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM"), (unsigned int)SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM},
{std::string("WITNESS_PUBKEYTYPE"), (unsigned int)SCRIPT_VERIFY_WITNESS_PUBKEYTYPE},
{std::string("CONST_SCRIPTCODE"), (unsigned int)SCRIPT_VERIFY_CONST_SCRIPTCODE},
{std::string("TAPROOT"), (unsigned int)SCRIPT_VERIFY_TAPROOT},
{std::string("DISCOURAGE_UPGRADABLE_PUBKEYTYPE"), (unsigned int)SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_PUBKEYTYPE},
{std::string("DISCOURAGE_OP_SUCCESS"), (unsigned int)SCRIPT_VERIFY_DISCOURAGE_OP_SUCCESS},
{std::string("DISCOURAGE_UPGRADABLE_TAPROOT_VERSION"), (unsigned int)SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION},
}
@ SCRIPT_VERIFY_NULLDUMMY
Definition: interpreter.h:64
@ SCRIPT_VERIFY_P2SH
Definition: interpreter.h:49
@ SCRIPT_VERIFY_SIGPUSHONLY
Definition: interpreter.h:67
@ SCRIPT_VERIFY_DISCOURAGE_OP_SUCCESS
Definition: interpreter.h:141
@ SCRIPT_VERIFY_WITNESS
Definition: interpreter.h:108
@ SCRIPT_VERIFY_CONST_SCRIPTCODE
Definition: interpreter.h:130
@ SCRIPT_VERIFY_MINIMALIF
Definition: interpreter.h:118
@ SCRIPT_VERIFY_LOW_S
Definition: interpreter.h:61
@ SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY
Definition: interpreter.h:99
@ SCRIPT_VERIFY_WITNESS_PUBKEYTYPE
Definition: interpreter.h:126
@ SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION
Definition: interpreter.h:138
@ SCRIPT_VERIFY_TAPROOT
Definition: interpreter.h:134
@ SCRIPT_VERIFY_STRICTENC
Definition: interpreter.h:54
@ SCRIPT_VERIFY_NULLFAIL
Definition: interpreter.h:122
@ SCRIPT_VERIFY_DERSIG
Definition: interpreter.h:57
@ SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_PUBKEYTYPE
Definition: interpreter.h:144
@ SCRIPT_VERIFY_CLEANSTACK
Definition: interpreter.h:94
@ SCRIPT_VERIFY_MINIMALDATA
Definition: interpreter.h:73
@ SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS
Definition: interpreter.h:85
@ SCRIPT_VERIFY_CHECKSEQUENCEVERIFY
Definition: interpreter.h:104
@ SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM
Definition: interpreter.h:112

Definition at line 51 of file transaction_tests.cpp.