Skip to content

Prevent slow chain polls from starving fee updates - #1146

Open
benthecarman wants to merge 1 commit into
lightningdevkit:mainfrom
benthecarman:fix-audit-ldk-node-issue-159
Open

benthecarman wants to merge 1 commit into
lightningdevkit:mainfrom
benthecarman:fix-audit-ldk-node-issue-159

Conversation

@benthecarman

Copy link
Copy Markdown
Contributor

The bitcoind polling loop used a biased select over two separate two-second intervals, with the chain polling tick prioritized over the fee rate update tick. If each chain poll took longer than the polling interval, the chain tick was already ready every time we returned to the select, so the fee rate update branch was never taken and fee estimates could go stale indefinitely.

Since both intervals fire at the same rate anyway, we now drop the separate fee rate interval and update fee rate estimates right after each chain poll whenever the best block changed. Every step still races against the stop signal, so shutdown remains prompt.

This was found by Project Loupe.

The bitcoind polling loop used a biased select over two separate
two-second intervals, with the chain polling tick prioritized over the
fee rate update tick. If each chain poll took longer than the polling
interval, the chain tick was already ready every time we returned to
the select, so the fee rate update branch was never taken and fee
estimates could go stale indefinitely.

Since both intervals fire at the same rate anyway, we now drop the
separate fee rate interval and update fee rate estimates right after
each chain poll whenever the best block changed. Every step still
races against the stop signal, so shutdown remains prompt.

This was found by Project Loupe.

This change was made with the help of Claude Code.
@ldk-reviews-bot

ldk-reviews-bot commented Oct 9, 2026 •

Copy link
Copy Markdown

I've assigned @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@ldk-reviews-bot
ldk-reviews-bot requested a review from tnull October 9, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants