6 #ifndef BITCOIN_NODE_MINER_H 7 #define BITCOIN_NODE_MINER_H 12 #include <txmempool.h> 18 #include <boost/multi_index/identity.hpp> 19 #include <boost/multi_index/indexed_by.hpp> 20 #include <boost/multi_index/ordered_index.hpp> 21 #include <boost/multi_index/tag.hpp> 22 #include <boost/multi_index_container.hpp> 93 if (a->GetCountWithAncestors() != b->GetCountWithAncestors()) {
94 return a->GetCountWithAncestors() < b->GetCountWithAncestors();
102 boost::multi_index::ordered_unique<
104 CompareCTxMemPoolIter
107 boost::multi_index::ordered_non_unique<
109 boost::multi_index::tag<ancestor_score>,
110 boost::multi_index::identity<CTxMemPoolModifiedEntry>,
111 CompareTxMemPoolEntryByAncestorFee
116 typedef boost::multi_index_container<
121 typedef indexed_modified_transaction_set::nth_index<0>::type::iterator
modtxiter;
122 typedef indexed_modified_transaction_set::index<ancestor_score>::type::iterator
modtxscoreiter;
150 std::unordered_set<Txid, SaltedTxidHasher>
inBlock;
197 bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost)
const;
216 #endif // BITCOIN_NODE_MINER_H static const bool DEFAULT_PRINT_MODIFIED_FEE
indexed_modified_transaction_set::index< ancestor_score >::type::iterator modtxscoreiter
void onlyUnconfirmed(CTxMemPool::setEntries &testSet)
Remove confirmed (inBlock) entries from given set.
indexed_transaction_set::nth_index< 0 >::type::const_iterator txiter
Generate a new block, without valid proof-of-work.
void resetBlock()
Clear the block's state and prepare for assembling a new block.
bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost) const
Test if a new package would "fit" in the block.
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const
bool TestPackageTransactions(const CTxMemPool::setEntries &package) const
Perform checks on each transaction in a package: locktime, premature-witness, serialized size (if nec...
void SortForBlock(const CTxMemPool::setEntries &package, std::vector< CTxMemPool::txiter > &sortedEntries)
Sort the package in an order that is valid to appear in a block.
static std::optional< int64_t > m_last_block_num_txs
std::set< txiter, CompareIteratorByHash > setEntries
Comparator for CTxMemPool::txiter objects.
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system...
void addPackageTxs(const CTxMemPool &mempool, int &nPackagesSelected, int &nDescendantsUpdated) EXCLUSIVE_LOCKS_REQUIRED(mempool.cs)
Add transactions based on feerate including unconfirmed ancestors Increments nPackagesSelected / nDes...
util::Result< void > ApplyArgsManOptions(const ArgsManager &args, BlockManager::Options &opts)
void operator()(CTxMemPoolModifiedEntry &e)
int64_t UpdateTime(CBlockHeader *pblock, const Consensus::Params &consensusParams, const CBlockIndex *pindexPrev)
int64_t m_lock_time_cutoff
std::vector< unsigned char > vchCoinbaseCommitment
void AddToBlock(CTxMemPool::txiter iter)
Add a tx to the block.
Transaction validation functions.
const CTransaction & GetTx() const
int64_t CAmount
Amount in satoshis (Can be negative)
std::vector< int64_t > vTxSigOpsCost
CAmount nModFeesWithAncestors
CAmount GetModifiedFee() const
Chainstate stores and provides an API to update our local knowledge of the current best chain...
boost::multi_index_container< CTxMemPoolModifiedEntry, CTxMemPoolModifiedEntry_Indices > indexed_modified_transaction_set
std::unique_ptr< CBlockTemplate > CreateNewBlock(const CScript &scriptPubKeyIn)
Construct a new block template with coinbase to scriptPubKeyIn.
Parameters that influence chain consensus.
std::unordered_set< Txid, SaltedTxidHasher > inBlock
Chainstate & m_chainstate
CTxMemPoolModifiedEntry(CTxMemPool::txiter entry)
update_for_parent_inclusion(CTxMemPool::txiter it)
static std::optional< int64_t > m_last_block_weight
#define EXCLUSIVE_LOCKS_REQUIRED(...)
CAmount GetModFeesWithAncestors() const
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
int64_t nSigOpCostWithAncestors
The block chain is a tree shaped structure starting with the genesis block at the root...
const CChainParams & Params()
Return the currently selected parameters.
Serialized script, used inside transaction inputs and outputs.
BlockAssembler(Chainstate &chainstate, const CTxMemPool *mempool, const Options &options)
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const
const CChainParams & chainparams
indexed_modified_transaction_set::nth_index< 0 >::type::iterator modtxiter
static constexpr unsigned int DEFAULT_BLOCK_MAX_WEIGHT
Default for -blockmaxweight, which controls the range of block weights the mining code will create...
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
static constexpr unsigned int DEFAULT_BLOCK_MIN_TX_FEE
Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by min...
uint64_t nBlockSigOpsCost
std::vector< CAmount > vTxFees
CTxMemPool::txiter result_type
The basic transaction that is broadcasted on the network and contained in blocks. ...
result_type operator()(const CTxMemPoolModifiedEntry &entry) const
std::unique_ptr< CBlockTemplate > pblocktemplate
is a home for public enum and struct type definitions that are used by internally by node code...
void RegenerateCommitments(CBlock &block, ChainstateManager &chainman)
Update an old GenerateCoinbaseCommitment from CreateNewBlock after the block txs have changed...
uint64_t nSizeWithAncestors
uint64_t GetSizeWithAncestors() const
const CTxMemPool *const m_mempool