Bitcoin Core 31.99.0
P2P Digital Currency
Public Member Functions | List of all members
interfaces::BlockTemplate Class Referenceabstract

Block template interface. More...

#include <mining.h>

Public Member Functions

virtual ~BlockTemplate ()=default
 
virtual CBlockHeader getBlockHeader ()=0
 
virtual CBlock getBlock ()=0
 
virtual std::vector< CAmountgetTxFees ()=0
 
virtual std::vector< int64_t > getTxSigops ()=0
 
virtual node::CoinbaseTx getCoinbaseTx ()=0
 Return fields needed to construct a coinbase transaction. More...
 
virtual std::vector< uint256getCoinbaseMerklePath ()=0
 Compute merkle path to the coinbase transaction. More...
 
virtual bool submitSolution (uint32_t version, uint32_t timestamp, uint32_t nonce, CTransactionRef coinbase, std::string &reason, std::string &debug)=0
 Construct and broadcast the block. More...
 
virtual bool submitSolutionOld7 (uint32_t, uint32_t, uint32_t, CTransactionRef)
 Deprecated older method preserved to return an explicit error for IPC clients using mining.capnp @7. More...
 
virtual std::unique_ptr< BlockTemplatewaitNext (node::BlockWaitOptions options={})=0
 Waits for fees in the next block to rise, a new tip or the timeout. More...
 
virtual void interruptWait ()=0
 Interrupts the current wait for the next block template. More...
 

Detailed Description

Block template interface.

Definition at line 30 of file mining.h.

Constructor & Destructor Documentation

◆ ~BlockTemplate()

virtual interfaces::BlockTemplate::~BlockTemplate ( )
virtualdefault

Member Function Documentation

◆ getBlock()

virtual CBlock interfaces::BlockTemplate::getBlock ( )
pure virtual

◆ getBlockHeader()

virtual CBlockHeader interfaces::BlockTemplate::getBlockHeader ( )
pure virtual

◆ getCoinbaseMerklePath()

virtual std::vector< uint256 > interfaces::BlockTemplate::getCoinbaseMerklePath ( )
pure virtual

Compute merkle path to the coinbase transaction.

Returns
merkle path ordered from the deepest

◆ getCoinbaseTx()

virtual node::CoinbaseTx interfaces::BlockTemplate::getCoinbaseTx ( )
pure virtual

Return fields needed to construct a coinbase transaction.

◆ getTxFees()

virtual std::vector< CAmount > interfaces::BlockTemplate::getTxFees ( )
pure virtual

◆ getTxSigops()

virtual std::vector< int64_t > interfaces::BlockTemplate::getTxSigops ( )
pure virtual

◆ interruptWait()

virtual void interfaces::BlockTemplate::interruptWait ( )
pure virtual

Interrupts the current wait for the next block template.

◆ submitSolution()

virtual bool interfaces::BlockTemplate::submitSolution ( uint32_t  version,
uint32_t  timestamp,
uint32_t  nonce,
CTransactionRef  coinbase,
std::string &  reason,
std::string &  debug 
)
pure virtual

Construct and broadcast the block.

Modifies the template in place, updating the fields listed below as well as the merkle root.

Parameters
[in]versionversion block header field
[in]timestamptime block header field (unix timestamp)
[in]noncenonce block header field
[in]coinbasecomplete coinbase transaction (including witness)
[out]reasonfailure reason (BIP22)
[out]debugmore detailed rejection reason
Note
Unlike the submitblock RPC, this method does not call UpdateUncommittedBlockStructures to add a missing coinbase witness reserved value. Callers must provide a complete coinbase transaction, including the witness when a witness commitment is present.
for heights <= 16, the BIP34 height push in getCoinbaseTx().script_sig_prefix is only one byte long, so the coinbase scriptSig needs at least one additional byte of data to avoid bad-cb-length.
Returns
true if the block was accepted as a new block

◆ submitSolutionOld7()

virtual bool interfaces::BlockTemplate::submitSolutionOld7 ( uint32_t  ,
uint32_t  ,
uint32_t  ,
CTransactionRef   
)
inlinevirtual

Deprecated older method preserved to return an explicit error for IPC clients using mining.capnp @7.

Definition at line 81 of file mining.h.

◆ waitNext()

virtual std::unique_ptr< BlockTemplate > interfaces::BlockTemplate::waitNext ( node::BlockWaitOptions  options = {})
pure virtual

Waits for fees in the next block to rise, a new tip or the timeout.

Parameters
[in]optionsControl the timeout (default forever) and by how much total fees for the next block should rise (default infinite).
Returns
a new BlockTemplate or nothing if the timeout occurs.

On testnet this will additionally return a template with difficulty 1 if the tip is more than 20 minutes old.


The documentation for this class was generated from the following file: