Bitcoin Core 31.99.0
P2P Digital Currency
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 CChainParams;
15class COutPoint;
16namespace node {
17struct BlockCreateOptions;
18struct NodeContext;
19} // namespace node
20
22std::vector<std::shared_ptr<CBlock>> CreateBlockChain(size_t total_height, const CChainParams& params);
23
26 const node::BlockCreateOptions& assembler_options);
27
32COutPoint MineBlock(const node::NodeContext&, std::shared_ptr<CBlock>& block);
33
37COutPoint ProcessBlock(const node::NodeContext&, const std::shared_ptr<CBlock>& block);
38
40std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext& node,
41 const node::BlockCreateOptions& assembler_options);
42
44COutPoint generatetoaddress(const node::NodeContext&, const std::string& address);
45
46#endif // BITCOIN_TEST_UTIL_MINING_H
Definition: block.h:74
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:29
Definition: messages.h:21
Block template creation options.
Definition: mining_types.h:33
NodeContext struct containing references to chain state and connection state.
Definition: context.h:59
std::shared_ptr< CBlock > PrepareBlock(const node::NodeContext &node, const node::BlockCreateOptions &assembler_options)
Prepare a block to be mined.
Definition: mining.cpp:131
COutPoint ProcessBlock(const node::NodeContext &, const std::shared_ptr< CBlock > &block)
Returns the generated coin (or Null if the block was invalid).
Definition: mining.cpp:112
COutPoint MineBlock(const node::NodeContext &, const node::BlockCreateOptions &assembler_options)
Returns the generated coin.
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
COutPoint generatetoaddress(const node::NodeContext &, const std::string &address)
RPC-like helper function, returns the generated coin.
Definition: mining.cpp:34