![]() |
Bitcoin Core
25.99.0
P2P Digital Currency
|
A minimal version of BlockAssembler. More...
#include <mini_miner.h>
Public Member Functions | |
bool | IsReadyToCalculate () const |
Returns true if CalculateBumpFees may be called, false if not. More... | |
void | BuildMockTemplate (const CFeeRate &target_feerate) |
Build a block template until the target feerate is hit. More... | |
std::set< uint256 > | GetMockTemplateTxids () const |
Returns set of txids in the block template if one has been constructed. More... | |
MiniMiner (const CTxMemPool &mempool, const std::vector< COutPoint > &outpoints) | |
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 make it into the block, calculate the cost of bumping those transactions (and their ancestors) to the minimum feerate. More... | |
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 it into the block to the target feerate. More... | |
Private Types | |
using | MockEntryMap = decltype(m_entries_by_txid) |
Private Member Functions | |
void | DeleteAncestorPackage (const std::set< MockEntryMap::iterator, IteratorComparator > &ancestors) |
Consider this ancestor package "mined" so remove all these entries from our data structures. More... | |
void | SanityCheck () const |
Perform some checks. More... | |
Private Attributes | |
bool | m_ready_to_calculate {true} |
std::set< uint256 > | m_to_be_replaced |
std::map< uint256, std::vector< COutPoint > > | m_requested_outpoints_by_txid |
std::map< COutPoint, CAmount > | m_bump_fees |
std::set< uint256 > | m_in_block |
CAmount | m_total_fees {0} |
int32_t | m_total_vsize {0} |
std::map< uint256, MiniMinerMempoolEntry > | m_entries_by_txid |
Main data structure holding the entries, can be indexed by txid. More... | |
std::vector< MockEntryMap::iterator > | m_entries |
Vector of entries, can be sorted by ancestor feerate. More... | |
std::map< uint256, std::vector< MockEntryMap::iterator > > | m_descendant_set_by_txid |
Map of txid to its descendants. More... | |
A minimal version of BlockAssembler.
Allows us to run the mining algorithm on a subset of mempool transactions, ignoring consensus rules, to calculate mining scores.
Definition at line 55 of file mini_miner.h.
|
private |
Definition at line 82 of file mini_miner.h.
node::MiniMiner::MiniMiner | ( | const CTxMemPool & | mempool, |
const std::vector< COutPoint > & | outpoints | ||
) |
void node::MiniMiner::BuildMockTemplate | ( | const CFeeRate & | target_feerate | ) |
Build a block template until the target feerate is hit.
Definition at line 207 of file mini_miner.cpp.
std::map< COutPoint, CAmount > node::MiniMiner::CalculateBumpFees | ( | const CFeeRate & | target_feerate | ) |
Construct a new block template and, for each outpoint corresponding to a transaction that did not make it into the block, calculate the cost of bumping those transactions (and their ancestors) to the minimum feerate.
Returns a map from outpoint to bump fee, or an empty map if they cannot be calculated.
Definition at line 251 of file mini_miner.cpp.
Construct a new block template and, calculate the cost of bumping all transactions that did not make it into the block to the target feerate.
Returns the total bump fee, or std::nullopt if it cannot be calculated.
Definition at line 331 of file mini_miner.cpp.
|
private |
Consider this ancestor package "mined" so remove all these entries from our data structures.
Definition at line 159 of file mini_miner.cpp.
|
inline |
Returns set of txids in the block template if one has been constructed.
Definition at line 104 of file mini_miner.h.
|
inline |
Returns true if CalculateBumpFees may be called, false if not.
Definition at line 98 of file mini_miner.h.
|
private |
Perform some checks.
Definition at line 193 of file mini_miner.cpp.
Definition at line 71 of file mini_miner.h.
|
private |
|
private |
Vector of entries, can be sorted by ancestor feerate.
Definition at line 85 of file mini_miner.h.
|
private |
Main data structure holding the entries, can be indexed by txid.
Definition at line 81 of file mini_miner.h.
|
private |
Definition at line 74 of file mini_miner.h.
|
private |
Definition at line 59 of file mini_miner.h.
Definition at line 68 of file mini_miner.h.
|
private |
Definition at line 63 of file mini_miner.h.
|
private |
Definition at line 77 of file mini_miner.h.
|
private |
Definition at line 78 of file mini_miner.h.