![]() |
Bitcoin Core 32.99.0
P2P Digital Currency
|
#include <test/util/mining.h>#include <addresstype.h>#include <chain.h>#include <chainparams.h>#include <consensus/merkle.h>#include <consensus/validation.h>#include <key_io.h>#include <node/block_template_manager.h>#include <node/block_validation_state_catcher.h>#include <node/context.h>#include <node/miner.h>#include <pow.h>#include <primitives/block.h>#include <primitives/transaction.h>#include <script/script.h>#include <sync.h>#include <test/util/script.h>#include <uint256.h>#include <util/check.h>#include <validation.h>#include <validationinterface.h>#include <versionbits.h>#include <cstdint>#include <memory>#include <optional>#include <utility>Go to the source code of this file.
Functions | |
| COutPoint | generatetoaddress (const NodeContext &node, const std::string &address) |
| RPC-like helper function, returns the generated coin. | |
| std::vector< std::shared_ptr< CBlock > > | CreateBlockChain (size_t total_height, const CChainParams ¶ms) |
| Create a blockchain, starting from genesis. | |
| bool | BuildChain (const NodeContext &node, const CBlockIndex *pindex, const CScript &coinbase_script_pub_key, size_t length, std::vector< std::shared_ptr< CBlock > > &chain) |
Build a chain of length coinbase-only blocks on top of pindex (which need not be the active tip, allowing forks to be created) and submit their headers. | |
| COutPoint | MineBlock (const NodeContext &node, const node::BlockCreateOptions &assembler_options) |
| Returns the generated coin. | |
| COutPoint | MineBlock (const NodeContext &node, std::shared_ptr< CBlock > &block) |
| Returns the generated coin (or Null if the block was invalid). | |
| COutPoint | ProcessBlock (const NodeContext &node, const std::shared_ptr< CBlock > &block) |
| Returns the generated coin (or Null if the block was invalid). | |
| std::shared_ptr< CBlock > | PrepareBlock (const NodeContext &node, const node::BlockCreateOptions &assembler_options) |
| Prepare a block to be mined. | |
| bool BuildChain | ( | const node::NodeContext & | node, |
| const CBlockIndex * | pindex, | ||
| const CScript & | coinbase_script_pub_key, | ||
| size_t | length, | ||
| std::vector< std::shared_ptr< CBlock > > & | chain | ||
| ) |
Build a chain of length coinbase-only blocks on top of pindex (which need not be the active tip, allowing forks to be created) and submit their headers.
The blocks themselves are returned in chain for the caller to process.
Definition at line 80 of file mining.cpp.
| std::vector< std::shared_ptr< CBlock > > CreateBlockChain | ( | size_t | total_height, |
| const CChainParams & | params | ||
| ) |
Create a blockchain, starting from genesis.
Definition at line 45 of file mining.cpp.
| COutPoint generatetoaddress | ( | const NodeContext & | node, |
| const std::string & | address | ||
| ) |
RPC-like helper function, returns the generated coin.
Definition at line 36 of file mining.cpp.
| COutPoint MineBlock | ( | const NodeContext & | node, |
| const node::BlockCreateOptions & | assembler_options | ||
| ) |
Returns the generated coin.
Definition at line 121 of file mining.cpp.
| COutPoint MineBlock | ( | const node::NodeContext & | node, |
| std::shared_ptr< CBlock > & | block | ||
| ) |
Returns the generated coin (or Null if the block was invalid).
It is recommended to call RegenerateCommitments before mining the block to avoid merkle tree mismatches.
Definition at line 129 of file mining.cpp.
| std::shared_ptr< CBlock > PrepareBlock | ( | const NodeContext & | node, |
| const node::BlockCreateOptions & | assembler_options | ||
| ) |
Prepare a block to be mined.
Definition at line 158 of file mining.cpp.
| COutPoint ProcessBlock | ( | const NodeContext & | node, |
| const std::shared_ptr< CBlock > & | block | ||
| ) |
Returns the generated coin (or Null if the block was invalid).
Definition at line 139 of file mining.cpp.