Skip to content

Conversation

@moisesPompilio
Copy link
Contributor

When using BitcoindChainSource, the node was updating the fee_rate every 2 seconds, even if no new block had arrived. This behavior did not occur with other chain sources.

This change introduces a check against the last_best_block_hash before updating the fee rate in the periodic loop. If the current block hash is the same as the last known one, the update is skipped. The fee rate is only refreshed when a new block is detected, reducing redundant processing.

Note that this only affects the periodic update loop. Direct calls to update the fee_rate are not impacted

Close #520

Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think updating once per tip currently makes sense as Core estimates based on recently-mined transactions anyways. We might want to change that once they offer mempool-based fee estimation, which should be much more exact.

Please undraft!

@moisesPompilio moisesPompilio marked this pull request as ready for review September 10, 2025 18:27
@moisesPompilio
Copy link
Contributor Author

Ok, it was draft while I checked if a similar optimization was needed for Electrum/Esplora sources, but since they don’t have excessive updates I think no change is needed there for now.

@tnull tnull merged commit 8bd7f4d into lightningdevkit:main Sep 11, 2025
7 of 15 checks passed
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.

Feerates updated once every two seconds

2 participants