Repository navigation
Prevent slow chain polls from starving fee updates - #1146
benthecarman wants to merge 1 commit into
Conversation
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.
|
I've assigned @tnull as a reviewer! |
|
Field data point from a mainnet deployment, in case it helps prioritise review. Setup: ldk-node at Symptom: after switching this node from Esplora to bitcoind RPC, Why the poll exceeds the 2 s tick here: sampling With this PR cherry-picked onto Happy to test a revised version on this node if useful. |
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.