Changeset View
Changeset View
Standalone View
Standalone View
src/miner.h
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_MINER_H | #ifndef BITCOIN_MINER_H | ||||
#define BITCOIN_MINER_H | #define BITCOIN_MINER_H | ||||
#include "policy/policy.h" | |||||
#include "primitives/block.h" | #include "primitives/block.h" | ||||
#include "txmempool.h" | #include "txmempool.h" | ||||
#include "boost/multi_index/ordered_index.hpp" | #include "boost/multi_index/ordered_index.hpp" | ||||
#include "boost/multi_index_container.hpp" | #include "boost/multi_index_container.hpp" | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <memory> | #include <memory> | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | |||||
private: | private: | ||||
// The constructed block template | // The constructed block template | ||||
std::unique_ptr<CBlockTemplate> pblocktemplate; | std::unique_ptr<CBlockTemplate> pblocktemplate; | ||||
// A convenience pointer that always refers to the CBlock in pblocktemplate | // A convenience pointer that always refers to the CBlock in pblocktemplate | ||||
CBlock *pblock; | CBlock *pblock; | ||||
// Configuration parameters for the block size | // Configuration parameters for the block size | ||||
uint64_t nMaxGeneratedBlockSize; | uint64_t nMaxGeneratedBlockSize; | ||||
CFeeRate blockMinFeeRate; | CFeeRate blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE); | ||||
// Information on the current status of the block | // Information on the current status of the block | ||||
uint64_t nBlockSize; | uint64_t nBlockSize; | ||||
uint64_t nBlockTx; | uint64_t nBlockTx; | ||||
uint64_t nBlockSigOps; | uint64_t nBlockSigOps; | ||||
Amount nFees; | Amount nFees; | ||||
CTxMemPool::setEntries inBlock; | CTxMemPool::setEntries inBlock; | ||||
Show All 10 Lines | |||||
public: | public: | ||||
BlockAssembler(const Config &_config, const CChainParams &chainparams); | BlockAssembler(const Config &_config, const CChainParams &chainparams); | ||||
/** 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; } | ||||
void SetBlockMinTxFee(const Amount blockmintxfee); | |||||
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); | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |