![]() |
Bitcoin Core
24.1.0
P2P Digital Currency
|
Testing fixture that pre-creates a 100-block REGTEST-mode block chain. More...
#include <setup_common.h>
Public Member Functions | |
| TestChain100Setup (const std::string &chain_name=CBaseChainParams::REGTEST, const std::vector< const char *> &extra_args={}) | |
| CBlock | CreateAndProcessBlock (const std::vector< CMutableTransaction > &txns, const CScript &scriptPubKey, Chainstate *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, Chainstate &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... | |
| std::vector< CTransactionRef > | PopulateMempool (FastRandomContext &det_rand, size_t num_transactions, bool submit) |
| Create transactions spending from m_coinbase_txns. 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< CTransactionRef > | m_coinbase_txns |
| CKey | coinbaseKey |
Public Attributes inherited from ChainTestingSetup | |
| node::CacheSizes | m_cache_sizes {} |
Public Attributes inherited from BasicTestingSetup | |
| node::NodeContext | m_node |
| const fs::path | m_path_root |
| ArgsManager | m_args |
Testing fixture that pre-creates a 100-block REGTEST-mode block chain.
Definition at line 126 of file setup_common.h.
| TestChain100Setup::TestChain100Setup | ( | const std::string & | chain_name = CBaseChainParams::REGTEST, |
| const std::vector< const char *> & | extra_args = {} |
||
| ) |
Definition at line 266 of file setup_common.cpp.
| CBlock TestChain100Setup::CreateAndProcessBlock | ( | const std::vector< CMutableTransaction > & | txns, |
| const CScript & | scriptPubKey, | ||
| Chainstate * | 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 314 of file setup_common.cpp.
| CBlock TestChain100Setup::CreateBlock | ( | const std::vector< CMutableTransaction > & | txns, |
| const CScript & | scriptPubKey, | ||
| Chainstate & | chainstate | ||
| ) |
Create a new block with just given transactions, coinbase paying to scriptPubKey.
Definition at line 296 of file setup_common.cpp.
| 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.
| input_transaction | The transaction to spend |
| input_vout | The vout to spend from the input_transaction |
| input_height | The height of the block that included the input_transaction |
| input_signing_key | The key to spend the input_transaction |
| output_destination | Where to send the output |
| output_amount | How much to send |
| submit | Whether or not to submit to mempool |
Definition at line 331 of file setup_common.cpp.
| void TestChain100Setup::mineBlocks | ( | int | num_blocks | ) |
Mine a series of new blocks on the active chain.
Definition at line 285 of file setup_common.cpp.
| std::vector< CTransactionRef > TestChain100Setup::PopulateMempool | ( | FastRandomContext & | det_rand, |
| size_t | num_transactions, | ||
| bool | submit | ||
| ) |
Create transactions spending from m_coinbase_txns.
These transactions will only spend coins that exist in the current chain, but may be premature coinbase spends, have missing signatures, or violate some other consensus rules. They should only be used for testing mempool consistency. All transactions will have some random number of inputs and outputs (between 1 and 24). Transactions may or may not be dependent upon each other; if dependencies exit, every parent will always be somewhere in the list before the child so each transaction can be submitted in the same order they appear in the list.
| [in] | submit | When true, submit transactions to the mempool. When false, return them but don't submit them. |
Definition at line 380 of file setup_common.cpp.
| CKey TestChain100Setup::coinbaseKey |
Definition at line 184 of file setup_common.h.
| std::vector<CTransactionRef> TestChain100Setup::m_coinbase_txns |
Definition at line 183 of file setup_common.h.
1.8.14