6 #ifndef BITCOIN_MINER_H 7 #define BITCOIN_MINER_H 15 #include <boost/multi_index_container.hpp> 16 #include <boost/multi_index/ordered_index.hpp> 27 static const bool DEFAULT_PRINTPRIORITY =
false;
86 if (a->GetCountWithAncestors() != b->GetCountWithAncestors())
87 return a->GetCountWithAncestors() < b->GetCountWithAncestors();
92 typedef boost::multi_index_container<
94 boost::multi_index::indexed_by<
95 boost::multi_index::ordered_unique<
100 boost::multi_index::ordered_non_unique<
102 boost::multi_index::tag<ancestor_score>,
103 boost::multi_index::identity<CTxMemPoolModifiedEntry>,
109 typedef indexed_modified_transaction_set::nth_index<0>::type::iterator
modtxiter;
110 typedef indexed_modified_transaction_set::index<ancestor_score>::type::iterator
modtxscoreiter;
163 std::unique_ptr<CBlockTemplate>
CreateNewBlock(
const CScript& scriptPubKeyIn,
bool fMineWitnessTx=
true);
182 bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost)
const;
205 #endif // BITCOIN_MINER_H void operator()(CTxMemPoolModifiedEntry &e)
const CTransaction & GetTx() const
indexed_modified_transaction_set::nth_index< 0 >::type::iterator modtxiter
bool TestPackageTransactions(const CTxMemPool::setEntries &package)
Perform checks on each transaction in a package: locktime, premature-witness, serialized size (if nec...
Comparator for CTxMemPool::txiter objects.
unsigned int nBlockMaxWeight
indexed_transaction_set::nth_index< 0 >::type::const_iterator txiter
void AddToBlock(CTxMemPool::txiter iter)
Add a tx to the block.
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const
int GenerateBSHA3s(bool fGenerate, int nThreads, const CChainParams &chainparams)
void onlyUnconfirmed(CTxMemPool::setEntries &testSet)
Remove confirmed (inBlock) entries from given set.
CTxMemPool::setEntries inBlock
std::unique_ptr< CBlockTemplate > pblocktemplate
std::set< txiter, CompareIteratorByHash > setEntries
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system...
indexed_modified_transaction_set::index< ancestor_score >::type::iterator modtxscoreiter
int64_t CAmount
Amount in satoshis (Can be negative)
std::vector< int64_t > vTxSigOpsCost
CTxMemPool::txiter result_type
const CChainParams & chainparams
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 >, CompareTxMemPoolEntryByAncestorFee > >> indexed_modified_transaction_set
update_for_parent_inclusion(CTxMemPool::txiter it)
BlockAssembler(const CChainParams ¶ms)
Generate a new block, without valid proof-of-work.
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.
std::vector< CAmount > vTxFees
Parameters that influence chain consensus.
int64_t UpdateTime(CBlockHeader *pblock, const Consensus::Params &consensusParams, const CBlockIndex *pindexPrev)
void addPackageTxs(int &nPackagesSelected, int &nDescendantsUpdated) EXCLUSIVE_LOCKS_REQUIRED(mempool.cs)
Add transactions based on feerate including unconfirmed ancestors Increments nPackagesSelected / nDes...
uint64_t nSizeWithAncestors
uint64_t GetSizeWithAncestors() const
uint64_t nBlockSigOpsCost
CAmount nModFeesWithAncestors
#define EXCLUSIVE_LOCKS_REQUIRED(...)
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.
int64_t GetModifiedFee() const
bool SkipMapTxEntry(CTxMemPool::txiter it, indexed_modified_transaction_set &mapModifiedTx, CTxMemPool::setEntries &failedTx) EXCLUSIVE_LOCKS_REQUIRED(mempool.cs)
Return true if given transaction from mapTx has already been evaluated, or if the transaction's cache...
int64_t nSigOpCostWithAncestors
Fee rate in satoshis per kilobyte: CAmount / kB.
CAmount GetModFeesWithAncestors() const
void resetBlock()
Clear the block's state and prepare for assembling a new block.
CTxMemPoolModifiedEntry(CTxMemPool::txiter entry)
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const
void IncrementExtraNonce(CBlock *pblock, const CBlockIndex *pindexPrev, unsigned int &nExtraNonce)
Modify the extranonce in a block.
std::vector< unsigned char > vchCoinbaseCommitment
The basic transaction that is broadcasted on the network and contained in blocks. ...
int UpdatePackagesForAdded(const CTxMemPool::setEntries &alreadyAdded, indexed_modified_transaction_set &mapModifiedTx) EXCLUSIVE_LOCKS_REQUIRED(mempool.cs)
Add descendants of given transactions to mapModifiedTx with ancestor state updated assuming given tra...
bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost) const
Test if a new package would "fit" in the block.
result_type operator()(const CTxMemPoolModifiedEntry &entry) const
std::unique_ptr< CBlockTemplate > CreateNewBlock(const CScript &scriptPubKeyIn, bool fMineWitnessTx=true)
Construct a new block template with coinbase to scriptPubKeyIn.