Bitcoin Core 31.99.0
P2P Digital Currency
Classes | Functions
mining.cpp File Reference
#include <test/util/mining.h>
#include <addresstype.h>
#include <chain.h>
#include <chainparams.h>
#include <consensus/merkle.h>
#include <consensus/validation.h>
#include <interfaces/mining.h>
#include <key_io.h>
#include <node/context.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>
Include dependency graph for mining.cpp:

Go to the source code of this file.

Classes

struct  BlockValidationStateCatcher
 

Functions

COutPoint generatetoaddress (const NodeContext &node, const std::string &address)
 RPC-like helper function, returns the generated coin. More...
 
std::vector< std::shared_ptr< CBlock > > CreateBlockChain (size_t total_height, const CChainParams &params)
 Create a blockchain, starting from genesis. More...
 
COutPoint MineBlock (const NodeContext &node, const node::BlockCreateOptions &assembler_options)
 Returns the generated coin. More...
 
COutPoint MineBlock (const NodeContext &node, std::shared_ptr< CBlock > &block)
 Returns the generated coin (or Null if the block was invalid). More...
 
COutPoint ProcessBlock (const NodeContext &node, const std::shared_ptr< CBlock > &block)
 Returns the generated coin (or Null if the block was invalid). More...
 
std::shared_ptr< CBlockPrepareBlock (const NodeContext &node, const node::BlockCreateOptions &assembler_options)
 Prepare a block to be mined. More...
 

Function Documentation

◆ CreateBlockChain()

std::vector< std::shared_ptr< CBlock > > CreateBlockChain ( size_t  total_height,
const CChainParams params 
)

Create a blockchain, starting from genesis.

Definition at line 43 of file mining.cpp.

Here is the call graph for this function:

◆ generatetoaddress()

COutPoint generatetoaddress ( const NodeContext node,
const std::string &  address 
)

RPC-like helper function, returns the generated coin.

Definition at line 34 of file mining.cpp.

Here is the call graph for this function:

◆ MineBlock() [1/2]

COutPoint MineBlock ( const NodeContext node,
const node::BlockCreateOptions assembler_options 
)

Returns the generated coin.

Definition at line 78 of file mining.cpp.

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

◆ MineBlock() [2/2]

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 102 of file mining.cpp.

Here is the call graph for this function:

◆ PrepareBlock()

std::shared_ptr< CBlock > PrepareBlock ( const NodeContext node,
const node::BlockCreateOptions assembler_options 
)

Prepare a block to be mined.

Definition at line 131 of file mining.cpp.

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

◆ ProcessBlock()

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 112 of file mining.cpp.

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