#36182 fees: return `block_policy` fee rate estimate when `mempool_policy` is not ready

full analysis

https://github.com/bitcoin/bitcoin/pull/36182 · ismaelsadeeq · +406/-87 in 8 files, 3 commits · labels: TX fees and policy, Needs Backport (32.x)

Goal

  • Keep fee estimates working after node restarts when mempool data is still unready
  • Prevent transactions from underbidding fees due to premature floor estimates during high-fee periods

This pull request updates the fee estimation manager to fall back to the block-policy fee estimator whenever the mempool-policy estimator cannot produce an estimate. It also introduces a warmup period following a cold start or failed mempool reload, suppressing floor fee rate estimates from an empty mempool and falling back to block policy instead.

Problem: After node startup or cold restart without a persisted mempool, the mempool fee estimator has insufficient block observations and returns errors, causing default estimatesmartfee calls to fail for an hour or more even though the block policy estimator is ready. Additionally, an unpopulated mempool can cause the estimator to prematurely return the minimum relay fee floor, leading to transactions underbidding during high-fee periods.

Category: Mempool and policy (#1 of 10)

P2 · bug fix

  • P2 because it fixes fee estimation outages and underbidding after node restarts
  • Directly benefits wallet users and downstream L2 projects relying on smart fee estimation

P2 because it resolves an active user and downstream L2 issue where estimatesmartfee fails or severely underbids after node restarts. Without this fallback, users updating to v32 or restarting their nodes encounter unexpected estimation outages and risk transaction delays from artificially floored fee rates.

Membership: Modifies mempool fee rate estimation logic in src/policy/fees/ and estimator management.

Factors: security/stability 1, bug 2, performance 0, user value 2, leverage 1

Reviewability: Ready

  • Ready to review now

The branch cleanly implements the agreed fallback strategy and has passing CI with extensive functional test coverage.

Author status: active

Resolved concerns:

  • Whether to retain partial historical block stats across a cold restart was resolved in favor of clearing them and using an explicit warmup period.
  • Ensured combined mode falls back to block policy on both low coverage and insufficient data errors rather than surfacing errors.
  • Updated init to avoid treating shutdown-interrupted mempool loads as load failures.

Agreement: Strong

  • Broad consensus that falling back to block policy makes sense (achow101, instagibbs)
  • Downstream L2 projects actively hit estimation failures after restarts (instagibbs)
  • Reviewed and verified without remaining concerns (polespinasa)

Broad concept and approach consensus across 5+ contributors, with tested approval from polespinasa.

Multiple maintainers and contributors agree that falling back to block policy is the correct behavior when mempool estimation is not ready. Concerns regarding the window clearing and warmup duration were addressed by the author with real-world test data.

  • achow101: 'Concept ACK... it makes sense to fallback to block policy if it is available and mempool policy is not.'
  • polespinasa: 'ACK a623083db1... Reviewed again, don't have anything to say'
  • instagibbs: 'got a report from LDK dev this is happening, where block estimates are working but mempool is not'

Review verdicts (DrahtBot): 0 (+1)

Files

301 lines under test/bench/ci.

  • src/test/mempool_fee_estimator_tests.cpp +193/-11
  • src/policy/fees/mempool_estimator.cpp +86/-47
  • test/functional/feature_fee_estimation.py +94/-3
  • src/policy/fees/mempool_estimator.h +27/-17
  • src/policy/fees/estimator_man.cpp +13/-12
  • src/init.cpp +8/-1
  • src/policy/fees/estimator_man.h +8/-1
  • src/rpc/fees.cpp +4/-3

Card

This PR modifies the fee estimation manager to fall back to the block-policy fee estimator when the mempool estimator is not ready or has insufficient data, rather than returning an error. It also introduces a warmup mechanism that prevents a newly started or unpersisted mempool from returning the minimum relay fee floor when the mempool is sparse. Downstream L2 projects such as LDK and node operators reported facing estimation errors and stalls on restarts, making this a high-value bug fix targeted for v32 backport. The PR is in a clean, reviewable state with broad concept support and an ACK.

Data

dossier JSON · extract JSON · model openrouter/google/gemini-3.8-flash, generated 2026-09-17T15:58, confidence high, input hash 472ed4173509eb68