mempool: use FeeFrac for ancestor/descendant score comparators #32799

pull theStack wants to merge 3 commits into bitcoin:master from theStack:202506-use-FeeFrac-for-mempool-comparators changing 1 files +19 −43
  1. theStack commented at 2:21 am on June 24, 2025: contributor

    Rather than determining fee-rates for the mempool index scores and comparators manually in a rather tedious way (even involving floating-points), use the FeeFrac class [1] to simplify and deduplicate the code. Note that though this is intended to be a refactoring PR, there might be subtle differences in behaviour due to floating-point arithmetic involved in the original code (to avoid overflows at the cost of precision loss), but these shouldn’t matter.

    [1] introduced in PR #29242, commit ce8e22542ed0b4fa5794d3203207146418d59473

  2. mempool: use `FeeFrac` for calculating descendant score ac9c113bd2
  3. mempool: use `FeeFrac` for calculating ancestor score 3322b3a059
  4. mempool: use `FeeFrac` for calculating regular score 922adf66ac
  5. DrahtBot added the label Mempool on Jun 24, 2025
  6. DrahtBot commented at 2:21 am on June 24, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32799.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK ismaelsadeeq, glozow

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  7. ismaelsadeeq approved
  8. ismaelsadeeq commented at 11:16 am on June 24, 2025: member
    Code review ACK 922adf66ac7420e21ea171d3586ea84554e5d91b
  9. fanquake requested review from glozow on Jun 24, 2025
  10. glozow requested review from murchandamus on Jun 25, 2025
  11. in src/txmempool.h:96 in 922adf66ac
    92@@ -93,36 +93,24 @@ class CompareTxMemPoolEntryByDescendantScore
    93 public:
    94     bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
    95     {
    96-        double a_mod_fee, a_size, b_mod_fee, b_size;
    97+        FeeFrac f1 = GetModFeeAndSize(a);
    


    glozow commented at 10:44 pm on June 26, 2025:
    nit: this (and the others) could be const
  12. glozow commented at 10:46 pm on June 26, 2025: member
    ACK 922adf66ac7420e21ea171d3586ea84554e5d91b great to get rid of these doubles (🤮)

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-07-07 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me