Bitcoin Core 32.1.0
P2P Digital Currency
Loading...
Searching...
No Matches
mining.h
Go to the documentation of this file.
1// Copyright (c) 2019-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_TEST_UTIL_MINING_H
6#define BITCOIN_TEST_UTIL_MINING_H
7
8#include <cstddef>
9#include <memory>
10#include <string>
11#include <vector>
12
13class CBlock;
14class CBlockIndex;
15class CChainParams;
16class COutPoint;
17class CScript;
18namespace node {
20struct NodeContext;
21} // namespace node
22
24std::vector<std::shared_ptr<CBlock>> CreateBlockChain(size_t total_height, const CChainParams& params);
25
31bool BuildChain(const node::NodeContext& node, const CBlockIndex* pindex, const CScript& coinbase_script_pub_key, size_t length, std::vector<std::shared_ptr<CBlock>>& chain);
32
35 const node::BlockCreateOptions& assembler_options);
36
41COutPoint MineBlock(const node::NodeContext&, std::shared_ptr<CBlock>& block);
42
46COutPoint ProcessBlock(const node::NodeContext&, const std::shared_ptr<CBlock>& block);
47
49std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext& node,
50 const node::BlockCreateOptions& assembler_options);
51
53COutPoint generatetoaddress(const node::NodeContext&, const std::string& address);
54
55#endif // BITCOIN_TEST_UTIL_MINING_H
Definition block.h:74
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition chain.h:94
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Definition chainparams.h:77
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition transaction.h:30
Serialized script, used inside transaction inputs and outputs.
Definition script.h:406
std::unique_ptr< interfaces::Chain > chain
Definition context.h:80
Block template creation options.
std::shared_ptr< CBlock > PrepareBlock(const NodeContext &node, const node::BlockCreateOptions &assembler_options)
Prepare a block to be mined.
Definition mining.cpp:172
COutPoint generatetoaddress(const NodeContext &node, const std::string &address)
RPC-like helper function, returns the generated coin.
Definition mining.cpp:34
COutPoint ProcessBlock(const NodeContext &node, const std::shared_ptr< CBlock > &block)
Returns the generated coin (or Null if the block was invalid).
Definition mining.cpp:153
COutPoint MineBlock(const NodeContext &node, const node::BlockCreateOptions &assembler_options)
Returns the generated coin.
Definition mining.cpp:119
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,...
Definition mining.cpp:78
std::vector< std::shared_ptr< CBlock > > CreateBlockChain(size_t total_height, const CChainParams &params)
Create a blockchain, starting from genesis.
Definition mining.cpp:43