MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / AncestorFeerateComparator

Class AncestorFeerateComparator

src/node/mini_miner.cpp:180–197  ·  view source on GitHub ↗

Compare by min(ancestor feerate, individual feerate), then txid Under the ancestor-based mining approach, high-feerate children can pay for parents, but high-feerate parents do not incentive inclusion of their children. Therefore the mining algorithm only considers transactions for inclusion on basis of the minimum of their own feerate or their ancestor feerate.

Source from the content-addressed store, hash-verified

178// parents do not incentive inclusion of their children. Therefore the mining algorithm only considers
179// transactions for inclusion on basis of the minimum of their own feerate or their ancestor feerate.
180struct AncestorFeerateComparator
181{
182 template<typename I>
183 bool operator()(const I& a, const I& b) const {
184 auto min_feerate = [](const MiniMinerMempoolEntry& e) -> FeeFrac {
185 FeeFrac self_feerate(e.GetModifiedFee(), e.GetTxSize());
186 FeeFrac ancestor_feerate(e.GetModFeesWithAncestors(), e.GetSizeWithAncestors());
187 return std::min<ByRatioNegSize<FeeFrac>>(ancestor_feerate, self_feerate);
188 };
189 FeeFrac a_feerate{min_feerate(a->second)};
190 FeeFrac b_feerate{min_feerate(b->second)};
191 if (a_feerate != b_feerate) {
192 return ByRatioNegSize{a_feerate} > ByRatioNegSize{b_feerate};
193 }
194 // Use txid as tiebreaker for stable sorting
195 return a->first < b->first;
196 }
197};
198
199void MiniMiner::DeleteAncestorPackage(const std::set<MockEntryMap::iterator, IteratorComparator>& ancestors)
200{

Callers 1

BuildMockTemplateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected