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-2019 The Bitcoin Core developers | // Copyright (c) 2009-2019 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 <optional.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 152 Lines • ▼ Show 20 Lines | 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; } | ||||
static Optional<int64_t> m_last_block_num_txs; | static std::optional<int64_t> m_last_block_num_txs; | ||||
static Optional<int64_t> m_last_block_size; | static std::optional<int64_t> m_last_block_size; | ||||
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 49 Lines • Show Last 20 Lines |