Bitcoin Core  22.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | List of all members
TestChain100Setup Struct Reference

Testing fixture that pre-creates a 100-block REGTEST-mode block chain. More...

#include <setup_common.h>

Inheritance diagram for TestChain100Setup:
[legend]
Collaboration diagram for TestChain100Setup:
[legend]

Public Member Functions

 TestChain100Setup (const std::vector< const char * > &extra_args={})
 
CBlock CreateAndProcessBlock (const std::vector< CMutableTransaction > &txns, const CScript &scriptPubKey, CChainState *chainstate=nullptr)
 Create a new block with just given transactions, coinbase paying to scriptPubKey, and try to add it to the current chain. More...
 
CBlock CreateBlock (const std::vector< CMutableTransaction > &txns, const CScript &scriptPubKey, CChainState &chainstate)
 Create a new block with just given transactions, coinbase paying to scriptPubKey. More...
 
void mineBlocks (int num_blocks)
 Mine a series of new blocks on the active chain. More...
 
CMutableTransaction CreateValidMempoolTransaction (CTransactionRef input_transaction, int input_vout, int input_height, CKey input_signing_key, CScript output_destination, CAmount output_amount=CAmount(1 *COIN), bool submit=true)
 Create a transaction and submit to the mempool. More...
 
- Public Member Functions inherited from TestingSetup
 TestingSetup (const std::string &chainName=CBaseChainParams::MAIN, const std::vector< const char * > &extra_args={})
 
- Public Member Functions inherited from ChainTestingSetup
 ChainTestingSetup (const std::string &chainName=CBaseChainParams::MAIN, const std::vector< const char * > &extra_args={})
 
 ~ChainTestingSetup ()
 
- Public Member Functions inherited from BasicTestingSetup
 BasicTestingSetup (const std::string &chainName=CBaseChainParams::MAIN, const std::vector< const char * > &extra_args={})
 
 ~BasicTestingSetup ()
 

Public Attributes

std::vector< CTransactionRefm_coinbase_txns
 
CKey coinbaseKey
 
- Public Attributes inherited from BasicTestingSetup
ECCVerifyHandle globalVerifyHandle
 
NodeContext m_node
 
const fs::path m_path_root
 
ArgsManager m_args
 

Detailed Description

Testing fixture that pre-creates a 100-block REGTEST-mode block chain.

Definition at line 116 of file setup_common.h.

Constructor & Destructor Documentation

◆ TestChain100Setup()

TestChain100Setup::TestChain100Setup ( const std::vector< const char * > &  extra_args = {})

Definition at line 208 of file setup_common.cpp.

Member Function Documentation

◆ CreateAndProcessBlock()

CBlock TestChain100Setup::CreateAndProcessBlock ( const std::vector< CMutableTransaction > &  txns,
const CScript scriptPubKey,
CChainState chainstate = nullptr 
)

Create a new block with just given transactions, coinbase paying to scriptPubKey, and try to add it to the current chain.

If no chainstate is specified, default to the active.

Definition at line 258 of file setup_common.cpp.

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

◆ CreateBlock()

CBlock TestChain100Setup::CreateBlock ( const std::vector< CMutableTransaction > &  txns,
const CScript scriptPubKey,
CChainState chainstate 
)

Create a new block with just given transactions, coinbase paying to scriptPubKey.

Definition at line 238 of file setup_common.cpp.

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

◆ CreateValidMempoolTransaction()

CMutableTransaction TestChain100Setup::CreateValidMempoolTransaction ( CTransactionRef  input_transaction,
int  input_vout,
int  input_height,
CKey  input_signing_key,
CScript  output_destination,
CAmount  output_amount = CAmount(1 * COIN),
bool  submit = true 
)

Create a transaction and submit to the mempool.

Parameters
input_transactionThe transaction to spend
input_voutThe vout to spend from the input_transaction
input_heightThe height of the block that included the input_transaction
input_signing_keyThe key to spend the input_transaction
output_destinationWhere to send the output
output_amountHow much to send
submitWhether or not to submit to mempool

Definition at line 276 of file setup_common.cpp.

Here is the call graph for this function:

◆ mineBlocks()

void TestChain100Setup::mineBlocks ( int  num_blocks)

Mine a series of new blocks on the active chain.

Definition at line 227 of file setup_common.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ coinbaseKey

CKey TestChain100Setup::coinbaseKey

Definition at line 160 of file setup_common.h.

◆ m_coinbase_txns

std::vector<CTransactionRef> TestChain100Setup::m_coinbase_txns

Definition at line 159 of file setup_common.h.


The documentation for this struct was generated from the following files: