6 #ifndef BITCOIN_MINER_H
7 #define BITCOIN_MINER_H
14 #include "boost/multi_index_container.hpp"
15 #include "boost/multi_index/ordered_index.hpp"
25 static const bool DEFAULT_PRINTPRIORITY =
false;
93 if (a->GetCountWithAncestors() != b->GetCountWithAncestors())
94 return a->GetCountWithAncestors() < b->GetCountWithAncestors();
99 typedef boost::multi_index_container<
101 boost::multi_index::indexed_by<
102 boost::multi_index::ordered_unique<
107 boost::multi_index::ordered_non_unique<
109 boost::multi_index::tag<ancestor_score>,
110 boost::multi_index::identity<CTxMemPoolModifiedEntry>,
116 typedef indexed_modified_transaction_set::nth_index<0>::type::iterator
modtxiter;
117 typedef indexed_modified_transaction_set::index<ancestor_score>::type::iterator
modtxscoreiter;
183 void addPackageTxs(
int &nPackagesSelected,
int &nDescendantsUpdated);
195 bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost);
int64_t CAmount
Amount in satoshis (Can be negative)
const CChainParams & Params()
Return the currently selected parameters.
Generate a new block, without valid proof-of-work.
bool TestForBlock(CTxMemPool::txiter iter)
Test if tx will still "fit" in the block.
void AddToBlock(CTxMemPool::txiter iter)
Add a tx to the block.
CTxMemPool::setEntries inBlock
bool isStillDependent(CTxMemPool::txiter iter)
Test if tx still has unconfirmed parents not yet in block.
bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost)
Test if a new package would "fit" in the block.
unsigned int nBlockMaxSize
void SortForBlock(const CTxMemPool::setEntries &package, CTxMemPool::txiter entry, std::vector< CTxMemPool::txiter > &sortedEntries)
Sort the package in an order that is valid to appear in a block.
void onlyUnconfirmed(CTxMemPool::setEntries &testSet)
Remove confirmed (inBlock) entries from given set.
bool TestPackageTransactions(const CTxMemPool::setEntries &package)
Perform checks on each transaction in a package: locktime, premature-witness, serialized size (if nec...
std::unique_ptr< CBlockTemplate > CreateNewBlock(const CScript &scriptPubKeyIn, bool fMineWitnessTx)
Construct a new block template with coinbase to scriptPubKeyIn.
BlockAssembler(const CChainParams &chainparams)
void resetBlock()
Clear the block's state and prepare for assembling a new block.
std::unique_ptr< CBlockTemplate > pblocktemplate
const CChainParams & chainparams
unsigned int nBlockMaxWeight
bool SkipMapTxEntry(CTxMemPool::txiter it, indexed_modified_transaction_set &mapModifiedTx, CTxMemPool::setEntries &failedTx)
Return true if given transaction from mapTx has already been evaluated, or if the transaction's cache...
void addPriorityTxs()
Add transactions based on tx "priority".
void addPackageTxs(int &nPackagesSelected, int &nDescendantsUpdated)
Add transactions based on feerate including unconfirmed ancestors Increments nPackagesSelected / nDes...
int UpdatePackagesForAdded(const CTxMemPool::setEntries &alreadyAdded, indexed_modified_transaction_set &mapModifiedTx)
Add descendants of given transactions to mapModifiedTx with ancestor state updated assuming given tra...
uint64_t nBlockSigOpsCost
The block chain is a tree shaped structure starting with the genesis block at the root,...
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Fee rate in satoshis per kilobyte: CAmount / kB.
A key allocated from the key pool.
Serialized script, used inside transaction inputs and outputs.
std::set< txiter, CompareIteratorByHash > setEntries
indexed_transaction_set::nth_index< 0 >::type::iterator txiter
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
indexed_modified_transaction_set::nth_index< 0 >::type::iterator modtxiter
void IncrementExtraNonce(CBlock *pblock, const CBlockIndex *pindexPrev, unsigned int &nExtraNonce)
Modify the extranonce in a block.
indexed_modified_transaction_set::index< ancestor_score >::type::iterator modtxscoreiter
int64_t UpdateTime(CBlockHeader *pblock, const Consensus::Params &consensusParams, const CBlockIndex *pindexPrev)
boost::multi_index_container< CTxMemPoolModifiedEntry, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< modifiedentry_iter, CompareCTxMemPoolIter >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ancestor_score >, boost::multi_index::identity< CTxMemPoolModifiedEntry >, CompareModifiedEntry > >> indexed_modified_transaction_set
std::vector< CAmount > vTxFees
std::vector< int64_t > vTxSigOpsCost
std::vector< unsigned char > vchCoinbaseCommitment
CTxMemPoolModifiedEntry(CTxMemPool::txiter entry)
uint64_t nSizeWithAncestors
CAmount nModFeesWithAncestors
int64_t nSigOpCostWithAncestors
Comparator for CTxMemPool::txiter objects.
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const
bool operator()(const CTxMemPoolModifiedEntry &a, const CTxMemPoolModifiedEntry &b) const
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const
Parameters that influence chain consensus.
result_type operator()(const CTxMemPoolModifiedEntry &entry) const
CTxMemPool::txiter result_type
update_for_parent_inclusion(CTxMemPool::txiter it)
void operator()(CTxMemPoolModifiedEntry &e)