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

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  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 (🤮)

  13. glozow merged this on Jul 9, 2025
  14. glozow closed this on Jul 9, 2025

  15. theStack deleted the branch on Jul 9, 2025
  16. stringintech referenced this in commit f19e7819e9 on Jul 19, 2025
  17. alexanderwiederin referenced this in commit 9997c3d993 on Jul 25, 2025
  18. alexanderwiederin referenced this in commit 8d6ebb9c4e on Jul 28, 2025
  19. alexanderwiederin referenced this in commit 533a4585b5 on Jul 28, 2025
  20. yuvicc referenced this in commit 22f55cf11d on Aug 26, 2025
  21. bug-castercv502 referenced this in commit d4bd8a1259 on Sep 28, 2025
  22. stickies-v referenced this in commit a19c56cd7c on Nov 4, 2025
  23. Kino1994 referenced this in commit 9693803938 on Jun 28, 2026
  24. BigcoinBGC referenced this in commit 49c892030d on Jun 30, 2026
  25. bitcoin locked this on Jul 30, 2026

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: 2026-08-11 10:51 UTC

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