Bitcoin ABC 0.30.7
P2P Digital Currency
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
node::BlockAssembler Class Reference

Generate a new block, without valid proof-of-work. More...

#include <miner.h>

Collaboration diagram for node::BlockAssembler:
[legend]

Classes

struct  Options
 

Public Member Functions

 BlockAssembler (const Config &config, Chainstate &chainstate, const CTxMemPool *mempool, const avalanche::Processor *avalanche=nullptr)
 
 BlockAssembler (Chainstate &chainstate, const CTxMemPool *mempool, const Options &options, const avalanche::Processor *avalanche=nullptr)
 
std::unique_ptr< CBlockTemplateCreateNewBlock (const CScript &scriptPubKeyIn)
 Construct a new block template with coinbase to scriptPubKeyIn. More...
 
uint64_t GetMaxGeneratedBlockSize () const
 

Static Public Attributes

static std::optional< int64_t > m_last_block_num_txs {std::nullopt}
 
static std::optional< int64_t > m_last_block_size {std::nullopt}
 

Private Member Functions

void resetBlock ()
 Clear the block's state and prepare for assembling a new block. More...
 
void AddToBlock (const CTxMemPoolEntryRef &entry)
 Add a tx to the block. More...
 
void addTxs (const CTxMemPool &mempool) EXCLUSIVE_LOCKS_REQUIRED(mempool.cs)
 Add transactions from the mempool based on individual tx feerate. More...
 
bool TestTxFits (uint64_t txSize, int64_t txSigChecks) const
 Test if a new Tx would "fit" in the block. More...
 
bool CheckTx (const CTransaction &tx) const
 Check the transaction for finality, etc before adding to block. More...
 

Private Attributes

std::unique_ptr< CBlockTemplatepblocktemplate
 
uint64_t nMaxGeneratedBlockSize
 
uint64_t nMaxGeneratedBlockSigChecks
 
CFeeRate blockMinFeeRate
 
uint64_t nBlockSize
 
uint64_t nBlockTx
 
uint64_t nBlockSigChecks
 
Amount nFees
 
int nHeight
 
int64_t m_lock_time_cutoff
 
const CChainParamschainParams
 
const CTxMemPool *const m_mempool
 
Chainstatem_chainstate
 
const avalanche::Processor *const m_avalanche
 
const bool fPrintPriority
 

Detailed Description

Generate a new block, without valid proof-of-work.

Definition at line 53 of file miner.h.

Constructor & Destructor Documentation

◆ BlockAssembler() [1/2]

node::BlockAssembler::BlockAssembler ( const Config config,
Chainstate chainstate,
const CTxMemPool mempool,
const avalanche::Processor avalanche = nullptr 
)

Definition at line 106 of file miner.cpp.

◆ BlockAssembler() [2/2]

node::BlockAssembler::BlockAssembler ( Chainstate chainstate,
const CTxMemPool mempool,
const Options options,
const avalanche::Processor avalanche = nullptr 
)

Definition at line 61 of file miner.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ AddToBlock()

void node::BlockAssembler::AddToBlock ( const CTxMemPoolEntryRef entry)
private

Add a tx to the block.

Definition at line 271 of file miner.cpp.

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

◆ addTxs()

void node::BlockAssembler::addTxs ( const CTxMemPool mempool)
private

Add transactions from the mempool based on individual tx feerate.

addTxs includes transactions paying a fee by ensuring that the partial ordering of transactions is maintained.

That is to say children come after parents, despite having a potentially larger fee.

Definition at line 298 of file miner.cpp.

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

◆ CheckTx()

bool node::BlockAssembler::CheckTx ( const CTransaction tx) const
private

Check the transaction for finality, etc before adding to block.

Definition at line 287 of file miner.cpp.

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

◆ CreateNewBlock()

std::unique_ptr< CBlockTemplate > node::BlockAssembler::CreateNewBlock ( const CScript scriptPubKeyIn)

Construct a new block template with coinbase to scriptPubKeyIn.

Definition at line 125 of file miner.cpp.

Here is the call graph for this function:

◆ GetMaxGeneratedBlockSize()

uint64_t node::BlockAssembler::GetMaxGeneratedBlockSize ( ) const
inline

Definition at line 99 of file miner.h.

◆ resetBlock()

void node::BlockAssembler::resetBlock ( )
private

Clear the block's state and prepare for assembling a new block.

Definition at line 111 of file miner.cpp.

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

◆ TestTxFits()

bool node::BlockAssembler::TestTxFits ( uint64_t  txSize,
int64_t  txSigChecks 
) const
private

Test if a new Tx would "fit" in the block.

Definition at line 259 of file miner.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ blockMinFeeRate

CFeeRate node::BlockAssembler::blockMinFeeRate
private

Definition at line 61 of file miner.h.

◆ chainParams

const CChainParams& node::BlockAssembler::chainParams
private

Definition at line 72 of file miner.h.

◆ fPrintPriority

const bool node::BlockAssembler::fPrintPriority
private

Definition at line 78 of file miner.h.

◆ m_avalanche

const avalanche::Processor* const node::BlockAssembler::m_avalanche
private

Definition at line 76 of file miner.h.

◆ m_chainstate

Chainstate& node::BlockAssembler::m_chainstate
private

Definition at line 75 of file miner.h.

◆ m_last_block_num_txs

std::optional< int64_t > node::BlockAssembler::m_last_block_num_txs {std::nullopt}
static

Definition at line 101 of file miner.h.

◆ m_last_block_size

std::optional< int64_t > node::BlockAssembler::m_last_block_size {std::nullopt}
static

Definition at line 102 of file miner.h.

◆ m_lock_time_cutoff

int64_t node::BlockAssembler::m_lock_time_cutoff
private

Definition at line 71 of file miner.h.

◆ m_mempool

const CTxMemPool* const node::BlockAssembler::m_mempool
private

Definition at line 74 of file miner.h.

◆ nBlockSigChecks

uint64_t node::BlockAssembler::nBlockSigChecks
private

Definition at line 66 of file miner.h.

◆ nBlockSize

uint64_t node::BlockAssembler::nBlockSize
private

Definition at line 64 of file miner.h.

◆ nBlockTx

uint64_t node::BlockAssembler::nBlockTx
private

Definition at line 65 of file miner.h.

◆ nFees

Amount node::BlockAssembler::nFees
private

Definition at line 67 of file miner.h.

◆ nHeight

int node::BlockAssembler::nHeight
private

Definition at line 70 of file miner.h.

◆ nMaxGeneratedBlockSigChecks

uint64_t node::BlockAssembler::nMaxGeneratedBlockSigChecks
private

Definition at line 60 of file miner.h.

◆ nMaxGeneratedBlockSize

uint64_t node::BlockAssembler::nMaxGeneratedBlockSize
private

Definition at line 59 of file miner.h.

◆ pblocktemplate

std::unique_ptr<CBlockTemplate> node::BlockAssembler::pblocktemplate
private

Definition at line 56 of file miner.h.


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