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); | |||||
deadalnix: It's not clear why this setter is needed. The config is passed in at construction, and it… | |||||
sickpigUnsubmitted Not Done Inline Actionsdid it that way because it was impossible to change blockmintxfee via ForceSetArg once the object was instantiated. It lead to a SEGABRT. sickpig@host:~/src/bitcoin-abc(arcpatch-D554)$> src/test/test_bitcoin --run_test=miner_tests Running 3 test cases... unknown location(0): fatal error in "CreateNewBlock_validity": memory access violation at address: 0x0000005c: no mapping at fault address test/miner_tests.cpp(134): last checkpoint *** 1 failure detected in test suite "Bitcoin Test Suite" test_bitcoin: /usr/include/boost/thread/pthread/condition_variable_fwd.hpp:81: boost::condition_variable::~condition_variable(): Assertion `!ret' failed. Aborted (core dumped) for more details see: sickpig: did it that way because it was impossible to change `blockmintxfee` via `ForceSetArg` once the… | |||||
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 |
It's not clear why this setter is needed. The config is passed in at construction, and it sounds like blockmintxfee fit right there. This sounds like a change that should go in on its own.