Bitcoin Core 32.99.0
P2P Digital Currency
Loading...
Searching...
No Matches
Functions
mining.cpp File Reference
#include <bitcoin-build-config.h>
#include <rpc/register.h>
#include <addresstype.h>
#include <arith_uint256.h>
#include <chain.h>
#include <chainparams.h>
#include <chainparamsbase.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/merkle.h>
#include <consensus/params.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <crypto/hex_base.h>
#include <interfaces/types.h>
#include <key_io.h>
#include <net.h>
#include <netbase.h>
#include <node/block_template_manager.h>
#include <node/blockstorage.h>
#include <node/block_validation_state_catcher.h>
#include <node/context.h>
#include <node/miner.h>
#include <node/mining_args.h>
#include <node/mining_types.h>
#include <node/warnings.h>
#include <policy/feerate.h>
#include <policy/policy.h>
#include <pow.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <rpc/blockchain.h>
#include <rpc/mining.h>
#include <rpc/protocol.h>
#include <rpc/request.h>
#include <rpc/server.h>
#include <rpc/server_util.h>
#include <rpc/util.h>
#include <script/descriptor.h>
#include <script/script.h>
#include <script/signingprovider.h>
#include <serialize.h>
#include <streams.h>
#include <sync.h>
#include <tinyformat.h>
#include <txmempool.h>
#include <uint256.h>
#include <univalue.h>
#include <util/chaintype.h>
#include <util/check.h>
#include <util/signalinterrupt.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/time.h>
#include <validation.h>
#include <validationinterface.h>
#include <versionbits.h>
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <limits>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <span>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

Go to the source code of this file.

Functions

static UniValue GetNetworkHashPS (int lookup, int height, const CChain &active_chain)
 Return average network hashes per second based on the last 'lookup' blocks, or from the last difficulty change if 'lookup' is -1.
 
static RPCMethod getnetworkhashps ()
 
static bool GenerateBlock (ChainstateManager &chainman, CBlock &&block, uint64_t &max_tries, std::shared_ptr< const CBlock > &block_out, bool process_new_block)
 
static UniValue generateBlocks (ChainstateManager &chainman, node::BlockTemplateManager &block_template_manager, const CScript &coinbase_output_script, int nGenerate, uint64_t nMaxTries)
 
static bool getScriptFromDescriptor (std::string_view descriptor, CScript &script, std::string &error)
 
static RPCMethod generatetodescriptor ()
 
static RPCMethod generate ()
 
static RPCMethod generatetoaddress ()
 
static RPCMethod generateblock ()
 
static RPCMethod getmininginfo ()
 
static RPCMethod prioritisetransaction ()
 
static RPCMethod getprioritisedtransactions ()
 
static UniValue BIP22ValidationResult (const BlockValidationState &state)
 
static std::string gbt_rule_value (const std::string &name, bool gbt_optional_rule)
 
static RPCMethod getblocktemplate ()
 
static RPCMethod submitblock ()
 
static RPCMethod submitheader ()
 
void RegisterMiningRPCCommands (CRPCTable &t)
 

Function Documentation

◆ BIP22ValidationResult()

static UniValue BIP22ValidationResult ( const BlockValidationState &  state)
static

Definition at line 619 of file mining.cpp.

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

◆ gbt_rule_value()

static std::string gbt_rule_value ( const std::string &  name,
bool  gbt_optional_rule 
)
static

Definition at line 638 of file mining.cpp.

Here is the caller graph for this function:

◆ generate()

static RPCMethod generate ( )
static

Definition at line 287 of file mining.cpp.

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

◆ generateblock()

static RPCMethod generateblock ( )
static

Definition at line 335 of file mining.cpp.

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

◆ GenerateBlock()

static bool GenerateBlock ( ChainstateManager &  chainman,
CBlock &&  block,
uint64_t &  max_tries,
std::shared_ptr< const CBlock > &  block_out,
bool  process_new_block 
)
static

Definition at line 167 of file mining.cpp.

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

◆ generateBlocks()

static UniValue generateBlocks ( ChainstateManager &  chainman,
node::BlockTemplateManager &  block_template_manager,
const CScript &  coinbase_output_script,
int  nGenerate,
uint64_t  nMaxTries 
)
static

Definition at line 194 of file mining.cpp.

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

◆ generatetoaddress()

static RPCMethod generatetoaddress ( )
static

Definition at line 294 of file mining.cpp.

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

◆ generatetodescriptor()

static RPCMethod generatetodescriptor ( )
static

Definition at line 249 of file mining.cpp.

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

◆ getblocktemplate()

static RPCMethod getblocktemplate ( )
static

Wait to respond until either the best block changes, OR there are more transactions.

The check for new transactions first happens after 1 minute and subsequently every 10 seconds. BIP22 does not require this particular interval. On mainnet the mempool changes frequently enough that in practice this RPC returns after 60 seconds, or sooner if the best block changes.

getblocktemplate is unlikely to be called by bitcoin-cli, so -rpcclienttimeout is not a concern. BIP22 recommends a long request timeout.

The longpollid is assumed to be a tip hash if it has the right format.

Definition at line 647 of file mining.cpp.

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

◆ getmininginfo()

static RPCMethod getmininginfo ( )
static

Definition at line 446 of file mining.cpp.

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

◆ getnetworkhashps()

static RPCMethod getnetworkhashps ( )
static

Definition at line 141 of file mining.cpp.

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

◆ GetNetworkHashPS()

static UniValue GetNetworkHashPS ( int  lookup,
int  height,
const CChain &  active_chain 
)
static

Return average network hashes per second based on the last 'lookup' blocks, or from the last difficulty change if 'lookup' is -1.

If 'height' is -1, compute the estimate from current chain tip. If 'height' is a valid block height, compute the estimate at the time when a given block was found.

Definition at line 95 of file mining.cpp.

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

◆ getprioritisedtransactions()

static RPCMethod getprioritisedtransactions ( )
static

Definition at line 579 of file mining.cpp.

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

◆ getScriptFromDescriptor()

static bool getScriptFromDescriptor ( std::string_view  descriptor,
CScript &  script,
std::string &  error 
)
static

Definition at line 214 of file mining.cpp.

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

◆ prioritisetransaction()

static RPCMethod prioritisetransaction ( )
static

Definition at line 533 of file mining.cpp.

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

◆ RegisterMiningRPCCommands()

void RegisterMiningRPCCommands ( CRPCTable &  t)

Definition at line 1163 of file mining.cpp.

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

◆ submitblock()

static RPCMethod submitblock ( )
static

Definition at line 1070 of file mining.cpp.

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

◆ submitheader()

static RPCMethod submitheader ( )
static

Definition at line 1123 of file mining.cpp.

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