17#include <boost/multi_index_container.hpp>
18#include <boost/multi_index/ordered_index.hpp>
85 if (a->GetCountWithAncestors() != b->GetCountWithAncestors())
86 return a->GetCountWithAncestors() < b->GetCountWithAncestors();
91typedef boost::multi_index_container<
93 boost::multi_index::indexed_by<
94 boost::multi_index::ordered_unique<
99 boost::multi_index::ordered_non_unique<
101 boost::multi_index::tag<ancestor_score>,
102 boost::multi_index::identity<CTxMemPoolModifiedEntry>,
108typedef indexed_modified_transaction_set::nth_index<0>::type::iterator
modtxiter;
109typedef indexed_modified_transaction_set::index<ancestor_score>::type::iterator
modtxscoreiter;
184 bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost)
const;
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.
int UpdatePackagesForAdded(const CTxMemPool::setEntries &alreadyAdded, indexed_modified_transaction_set &mapModifiedTx) EXCLUSIVE_LOCKS_REQUIRED(m_mempool.cs)
Add descendants of given transactions to mapModifiedTx with ancestor state updated assuming given tra...
void AddToBlock(CTxMemPool::txiter iter)
Add a tx to the block.
CTxMemPool::setEntries inBlock
CChainState & m_chainstate
void addPackageTxs(int &nPackagesSelected, int &nDescendantsUpdated) EXCLUSIVE_LOCKS_REQUIRED(m_mempool.cs)
Add transactions based on feerate including unconfirmed ancestors Increments nPackagesSelected / nDes...
bool TestPackageTransactions(const CTxMemPool::setEntries &package) const
Perform checks on each transaction in a package: locktime, premature-witness, serialized size (if nec...
void onlyUnconfirmed(CTxMemPool::setEntries &testSet)
Remove confirmed (inBlock) entries from given set.
static std::optional< int64_t > m_last_block_num_txs
const CTxMemPool & m_mempool
void resetBlock()
Clear the block's state and prepare for assembling a new block.
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::unique_ptr< CBlockTemplate > pblocktemplate
BlockAssembler(CChainState &chainstate, const CTxMemPool &mempool, const CChainParams ¶ms)
const CChainParams & chainparams
std::unique_ptr< CBlockTemplate > CreateNewBlock(const CScript &scriptPubKeyIn)
Construct a new block template with coinbase to scriptPubKeyIn.
static std::optional< int64_t > m_last_block_weight
bool SkipMapTxEntry(CTxMemPool::txiter it, indexed_modified_transaction_set &mapModifiedTx, CTxMemPool::setEntries &failedTx) EXCLUSIVE_LOCKS_REQUIRED(m_mempool.cs)
Return true if given transaction from mapTx has already been evaluated, or if the transaction's cache...
unsigned int nBlockMaxWeight
uint64_t nBlockSigOpsCost
bool TestPackage(uint64_t packageSize, int64_t packageSigOpsCost) const
Test if a new package would "fit" in the block.
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.
CChainState stores and provides an API to update our local knowledge of the current best chain.
Fee rate in satoshis per kilobyte: CAmount / kB.
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
std::set< txiter, CompareIteratorByHash > setEntries
indexed_transaction_set::nth_index< 0 >::type::const_iterator txiter
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
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.
static const bool DEFAULT_PRINTPRIORITY
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
indexed_modified_transaction_set::index< ancestor_score >::type::iterator modtxscoreiter
int64_t UpdateTime(CBlockHeader *pblock, const Consensus::Params &consensusParams, const CBlockIndex *pindexPrev)
void RegenerateCommitments(CBlock &block, ChainstateManager &chainman)
Update an old GenerateCoinbaseCommitment from CreateNewBlock after the block txs have changed.
Transaction validation functions.
std::vector< CAmount > vTxFees
std::vector< int64_t > vTxSigOpsCost
std::vector< unsigned char > vchCoinbaseCommitment
CTxMemPoolModifiedEntry(CTxMemPool::txiter entry)
int64_t GetModifiedFee() const
const CTransaction & GetTx() const
uint64_t nSizeWithAncestors
CAmount nModFeesWithAncestors
CAmount GetModFeesWithAncestors() const
int64_t nSigOpCostWithAncestors
uint64_t GetSizeWithAncestors() const
Comparator for CTxMemPool::txiter objects.
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &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)
#define EXCLUSIVE_LOCKS_REQUIRED(...)