5#ifndef BITCOIN_NODE_MINI_MINER_H
6#define BITCOIN_NODE_MINI_MINER_H
39 int64_t vsize_ancestor,
66 return a->first < b->first;
150 MiniMiner(
const std::vector<MiniMinerMempoolEntry>& manual_entries,
151 const std::map<
Txid, std::set<Txid>>& descendant_caches);
int64_t CAmount
Amount in satoshis (Can be negative)
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
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 ...
A minimal version of BlockAssembler, using the same ancestor set scoring algorithm.
std::map< uint256, std::vector< MockEntryMap::iterator > > m_descendant_set_by_txid
Map of txid to its descendants.
decltype(m_entries_by_txid) MockEntryMap
std::set< uint256 > GetMockTemplateTxids() const
Returns set of txids in the block template if one has been constructed.
std::map< Txid, uint32_t > Linearize()
Construct a new block template with all of the transactions and calculate the order in which they are...
std::map< COutPoint, CAmount > CalculateBumpFees(const CFeeRate &target_feerate)
Construct a new block template and, for each outpoint corresponding to a transaction that did not mak...
std::map< uint256, std::vector< COutPoint > > m_requested_outpoints_by_txid
std::optional< CAmount > CalculateTotalBumpFees(const CFeeRate &target_feerate)
Construct a new block template and, calculate the cost of bumping all transactions that did not make ...
std::set< uint256 > m_in_block
std::map< Txid, uint32_t > m_inclusion_order
bool IsReadyToCalculate() const
Returns true if CalculateBumpFees may be called, false if not.
void DeleteAncestorPackage(const std::set< MockEntryMap::iterator, IteratorComparator > &ancestors)
Consider this ancestor package "mined" so remove all these entries from our data structures.
std::map< uint256, MiniMinerMempoolEntry > m_entries_by_txid
Main data structure holding the entries, can be indexed by txid.
void SanityCheck() const
Perform some checks.
std::vector< MockEntryMap::iterator > m_entries
Vector of entries, can be sorted by ancestor feerate.
MiniMiner(const CTxMemPool &mempool, const std::vector< COutPoint > &outpoints)
Constructor that takes a list of outpoints that may or may not belong to transactions in the mempool.
std::set< uint256 > m_to_be_replaced
std::map< COutPoint, CAmount > m_bump_fees
bool m_ready_to_calculate
void BuildMockTemplate(std::optional< CFeeRate > target_feerate)
Build a block template until the target feerate is hit.
CAmount fee_with_ancestors
int64_t GetSizeWithAncestors() const
const int64_t vsize_individual
const CTransaction & GetTx() const LIFETIMEBOUND
MiniMinerMempoolEntry(const CTransactionRef &tx_in, int64_t vsize_self, int64_t vsize_ancestor, CAmount fee_self, CAmount fee_ancestor)
void UpdateAncestorState(int64_t vsize_change, CAmount fee_change)
CAmount GetModFeesWithAncestors() const
int64_t GetTxSize() const
int64_t vsize_with_ancestors
CAmount GetModifiedFee() const
const CAmount fee_individual
std::shared_ptr< const CTransaction > CTransactionRef
bool operator()(const I &a, const I &b) const