Changeset View
Changeset View
Standalone View
Standalone View
src/miner.h
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | private: | ||||
Amount nFees; | Amount nFees; | ||||
CTxMemPool::setEntries inBlock; | CTxMemPool::setEntries inBlock; | ||||
// Chain context for the block | // Chain context for the block | ||||
int nHeight; | int nHeight; | ||||
int64_t nLockTimeCutoff; | int64_t nLockTimeCutoff; | ||||
int64_t nMedianTimePast; | int64_t nMedianTimePast; | ||||
const CChainParams &chainparams; | const CChainParams &chainparams; | ||||
uint8_t nBlockPriorityPercentage; | |||||
const CTxMemPool *mempool; | const CTxMemPool *mempool; | ||||
// Variables used for addPriorityTxs | // Variables used for addPriorityTxs | ||||
int lastFewTxs; | int lastFewTxs; | ||||
public: | public: | ||||
struct Options { | struct Options { | ||||
Options(); | Options(); | ||||
uint64_t nExcessiveBlockSize; | uint64_t nExcessiveBlockSize; | ||||
uint64_t nMaxGeneratedBlockSize; | uint64_t nMaxGeneratedBlockSize; | ||||
CFeeRate blockMinFeeRate; | CFeeRate blockMinFeeRate; | ||||
uint8_t nBlockPriorityPercentage; | |||||
}; | }; | ||||
BlockAssembler(const Config &config, const CTxMemPool &_mempool); | BlockAssembler(const Config &config, const CTxMemPool &_mempool); | ||||
BlockAssembler(const CChainParams ¶ms, const CTxMemPool &_mempool, | BlockAssembler(const CChainParams ¶ms, const CTxMemPool &_mempool, | ||||
const Options &options); | const Options &options); | ||||
/** Construct a new block template with coinbase to scriptPubKeyIn */ | /** Construct a new block template with coinbase to scriptPubKeyIn */ | ||||
std::unique_ptr<CBlockTemplate> | std::unique_ptr<CBlockTemplate> | ||||
CreateNewBlock(const CScript &scriptPubKeyIn); | CreateNewBlock(const CScript &scriptPubKeyIn); | ||||
uint64_t GetMaxGeneratedBlockSize() const { return nMaxGeneratedBlockSize; } | uint64_t GetMaxGeneratedBlockSize() const { return nMaxGeneratedBlockSize; } | ||||
private: | private: | ||||
// utility functions | // utility functions | ||||
/** Clear the block's state and prepare for assembling a new block */ | /** Clear the block's state and prepare for assembling a new block */ | ||||
void resetBlock(); | void resetBlock(); | ||||
/** Add a tx to the block */ | /** Add a tx to the block */ | ||||
void AddToBlock(CTxMemPool::txiter iter); | void AddToBlock(CTxMemPool::txiter iter); | ||||
// Methods for how to add transactions to a block. | // Methods for how to add transactions to a block. | ||||
/** Add transactions based on tx "priority" */ | |||||
void addPriorityTxs() EXCLUSIVE_LOCKS_REQUIRED(mempool->cs); | |||||
/** | /** | ||||
* Add transactions based on feerate including unconfirmed ancestors. | * Add transactions based on feerate including unconfirmed ancestors. | ||||
* Increments nPackagesSelected / nDescendantsUpdated with corresponding | * Increments nPackagesSelected / nDescendantsUpdated with corresponding | ||||
* statistics from the package selection (for logging statistics). | * statistics from the package selection (for logging statistics). | ||||
*/ | */ | ||||
void addPackageTxs(int &nPackagesSelected, int &nDescendantsUpdated) | void addPackageTxs(int &nPackagesSelected, int &nDescendantsUpdated) | ||||
EXCLUSIVE_LOCKS_REQUIRED(mempool->cs); | EXCLUSIVE_LOCKS_REQUIRED(mempool->cs); | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |